我正在尝试部署诱惑报告,该报告是在"mvn清洁测试站点"之后生成的。我使用过mvn码头:当我试图打开时运行"http://localhost:8080",我在firefox浏览器中得到了一个"目录:/"文本,而不是实际的诱惑报告。
码头服务器的输出
错误部分
无错误
pom.xml
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>com.mycomp</groupId>
<artifactId>AllureWebDriverMvnProj</artifactId>
<version>0.0.1-SNAPSHOT</version>
<packaging>jar</packaging>
<properties>
<allure.version>1.5.0-RC1</allure.version>
<aspectj.version>1.8.7</aspectj.version>
</properties>
<dependencies>
<dependency>
<groupId>org.testng</groupId>
<artifactId>testng</artifactId>
<version>6.9.9</version>
</dependency>
<dependency>
<groupId>ru.stqa.selenium</groupId>
<artifactId>webdriver-factory</artifactId>
<version>1.1.46</version>
</dependency>
<dependency>
<groupId>ru.yandex.qatools.allure</groupId>
<artifactId>allure-testng-adaptor</artifactId>
<version>${allure.version}</version>
</dependency>
</dependencies>
<build>
<resources>
<resource>
<directory>src/main/resources</directory>
<filtering>true</filtering>
</resource>
</resources>
<testResources>
<testResource>
<directory>src/test/resources</directory>
<filtering>true</filtering>
</testResource>
</testResources>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-resources-plugin</artifactId>
<version>2.7</version>
<configuration>
<encoding>UTF-8</encoding>
</configuration>
</plugin>
<plugin>
<artifactId>maven-clean-plugin</artifactId>
<version>2.6</version>
<executions>
<execution>
<configuration>
<filesets>
<fileset>
<directory>${basedir}/target/site</directory>
<directory>${basedir}/target/allure-results</directory>
</fileset>
</filesets>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>2.18.1</version>
<configuration>
<suiteXmlFiles>
<suiteXmlFile>src/test/resources/testng.xml</suiteXmlFile>
<suiteXmlFile>src/test/resources/testng_demo.xml</suiteXmlFile>
</suiteXmlFiles>
<argLine>
-javaagent:${settings.localRepository}/org/aspectj/aspectjweaver/${aspectj.version}/aspectjweaver-${aspectj.version}.jar
</argLine>
</configuration>
<dependencies>
<dependency>
<groupId>org.aspectj</groupId>
<artifactId>aspectjweaver</artifactId>
<version>${aspectj.version}</version>
</dependency>
</dependencies>
</plugin>
<plugin>
<groupId>org.eclipse.jetty</groupId>
<artifactId>jetty-maven-plugin</artifactId>
<version>9.2.11.v20150529</version>
<configuration>
<configuration>
<webAppSourceDirectory>../AllureWebDriverMvnProj/target/site/allure-maven-plugin/</webAppSourceDirectory>
<stopKey>stop</stopKey>
<stopPort>1234</stopPort>
</configuration>
</configuration>
</plugin>
<plugin>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.2</version>
<configuration>
<source>1.6</source>
<target>1.6</target>
</configuration>
</plugin>
</plugins>
</build>
<reporting>
<excludeDefaults>true</excludeDefaults>
<plugins>
<plugin>
<groupId>ru.yandex.qatools.allure</groupId>
<artifactId>allure-maven-plugin</artifactId>
<version>2.4</version>
</plugin>
</plugins>
</reporting>
<!-- profiles -->
<profiles>
<!-- browsers -->
<profile>
<id>firefox</id>
<properties>
<capabilities>/firefox.capabilities</capabilities>
</properties>
<activation>
<activeByDefault>true</activeByDefault>
</activation>
</profile>
<profile>
<id>chrome</id>
<properties>
<capabilities>/chrome.capabilities</capabilities>
</properties>
</profile>
<profile>
<id>ie</id>
<properties>
<capabilities>/ie.capabilities</capabilities>
</properties>
</profile>
<profile>
<id>safari</id>
<properties>
<capabilities>/safari.capabilities</capabilities>
</properties>
</profile>
<profile>
<id>phantomjs</id>
<properties>
<capabilities>/phantomjs.capabilities</capabilities>
</properties>
</profile>
<profile>
<id>opera</id>
<properties>
<capabilities>/opera.capabilities</capabilities>
</properties>
</profile>
<profile>
<id>htmlunit</id>
<properties>
<capabilities>/htmlunit.capabilities</capabilities>
</properties>
</profile>
<!-- environments -->
<profile>
<id>localhost</id>
<properties>
<site.url>http://localhost/</site.url>
</properties>
<activation>
<activeByDefault>true</activeByDefault>
</activation>
</profile>
<profile>
<id>devhost</id>
<properties>
<site.url>http://devhost/</site.url>
</properties>
</profile>
<profile>
<id>testhost</id>
<properties>
<site.url>http://testhost/</site.url>
</properties>
</profile>
<profile>
<id>prodhost</id>
<properties>
<site.url>http://prodhost.com/</site.url>
</properties>
</profile>
<!-- grid -->
<profile>
<id>nogrid</id>
<properties>
<grid.url></grid.url>
</properties>
<activation>
<activeByDefault>true</activeByDefault>
</activation>
</profile>
<profile>
<id>grid</id>
<properties>
<grid.url>http://localhost:4444/wd/hub/</grid.url>
</properties>
</profile>
</profiles>
</project>
控制台输出
[INFO] Scanning for projects...
[INFO]
[INFO] Using the builder org.apache.maven.lifecycle.internal.builder.singlethreaded.SingleThreadedBuilder with a thread count of 1
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] Building AllureWebDriverMvnProj 0.0.1-SNAPSHOT
[INFO] ------------------------------------------------------------------------
[INFO]
[INFO] >>> jetty-maven-plugin:9.2.11.v20150529:run (default-cli) @ AllureWebDriverMvnProj >>>
[INFO]
[INFO] --- maven-resources-plugin:2.7:resources (default-resources) @ AllureWebDriverMvnProj ---
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] Copying 0 resource
[INFO]
[INFO] --- maven-compiler-plugin:3.2:compile (default-compile) @ AllureWebDriverMvnProj ---
[INFO] Nothing to compile - all classes are up to date
[INFO]
[INFO] --- maven-resources-plugin:2.7:testResources (default-testResources) @ AllureWebDriverMvnProj ---
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] Copying 11 resources
[INFO]
[INFO] --- maven-compiler-plugin:3.2:testCompile (default-testCompile) @ AllureWebDriverMvnProj ---
[INFO] Nothing to compile - all classes are up to date
[INFO]
[INFO] <<< jetty-maven-plugin:9.2.11.v20150529:run (default-cli) @ AllureWebDriverMvnProj <<<
[INFO]
[INFO] --- jetty-maven-plugin:9.2.11.v20150529:run (default-cli) @ AllureWebDriverMvnProj ---
2015-11-10 13:38:35.132:INFO::main: Logging initialized @9160ms
[INFO] Configuring Jetty for project: AllureWebDriverMvnProj
[INFO] webAppSourceDirectory not set. Trying srcmainwebapp
[INFO] webAppSourceDirectory E:Seleniumeclipse-jee-luna-SR2-win32Luna_Workspace_newAllureWebDriverMvnProjsrcmainwebapp does not exist. Trying E:Seleniumeclipse-jee-luna-SR2-win32Luna_Workspace_newAllureWebDriverMvnProjtargetwebapp-tmp
[INFO] Reload Mechanic: automatic
[INFO] Classes = E:Seleniumeclipse-jee-luna-SR2-win32Luna_Workspace_newAllureWebDriverMvnProjtargetclasses
[INFO] Context path = /
[INFO] Tmp directory = E:Seleniumeclipse-jee-luna-SR2-win32Luna_Workspace_newAllureWebDriverMvnProjtargettmp
[INFO] Web defaults = org/eclipse/jetty/webapp/webdefault.xml
[INFO] Web overrides = none
[INFO] web.xml file = null
[INFO] Webapp directory = E:Seleniumeclipse-jee-luna-SR2-win32Luna_Workspace_newAllureWebDriverMvnProjtargetwebapp-tmp
2015-11-10 13:38:35.337:INFO:oejs.Server:main: jetty-9.2.11.v20150529
2015-11-10 13:38:42.450:INFO:oejsh.ContextHandler:main: Started o.e.j.m.p.JettyWebAppContext@7d29df{/,file:/E:/Selenium/eclipse-jee-luna-SR2-win32/Luna_Workspace_new/AllureWebDriverMvnProj/target/webapp-tmp/,AVAILABLE}{file:/E:/Selenium/eclipse-jee-luna-SR2-win32/Luna_Workspace_new/AllureWebDriverMvnProj/target/webapp-tmp/}
2015-11-10 13:38:42.466:WARN:oejsh.RequestLogHandler:main: !RequestLog
2015-11-10 13:38:42.592:INFO:oejs.ServerConnector:main: Started ServerConnector@5cd81a{HTTP/1.1}{0.0.0.0:8080}[INFO] Started Jetty Server
2015-11-10 13:38:42.592:INFO:oejs.Server:main: Started @16620ms
在maven测试和站点是不同的阶段。您应该分两步运行maven命令:1.mvn清洁测试2.mvn站点然后您将获得生成的诱惑报告
@Illia B,谢谢回复。我们可以在提到"清洁测试"的同时提到"现场"。它会顺利工作的。问题出在配置标记上(我错误地提到了两次),webAppSourceDirectory标记指向了错误的目录。我把它定位在正确的道路上,它奏效了。