51Testing软件测试论坛

标题: 关于maven集成tomcat和jacoco进行手工测试覆盖率,但是没有成功 [打印本页]

作者: 测试积点老人    时间: 2019-2-28 09:36
标题: 关于maven集成tomcat和jacoco进行手工测试覆盖率,但是没有成功

我现在想用tomcat7-maven-plugin和jacoco-maven-plugin集成,进行手工测试的覆盖率监控。
但是现在发现使用mvn tomcat7:shutdown不能关闭tomcat服务,即不能触发post-integration-test。
所以jacoco.exec就没有更新。所以想看看各位谁知道问题出在哪里?

POM文件

  1. <!--tomcat插件 -->
  2.         <plugin>
  3.             <groupId>org.apache.tomcat.maven</groupId>
  4.             <artifactId>tomcat7-maven-plugin</artifactId>
  5.             <version>2.2</version>
  6.             <configuration>
  7.                 <url>http://localhost:8080/manager/html</url>  
  8.                 <server>tomcat</server>
  9.                 <contextReloadable>true</contextReloadable>
  10.                 <systemProperties>
  11.                     <JAVA_OPTS>${jacoco.agent.itArgLine}</JAVA_OPTS>
  12.                 </systemProperties>
  13.                 <stopKey>tomcat-shutdown</stopKey>
  14.                 <stopPort>9090</stopPort>
  15.                 <stopWait>10</stopWait>
  16.             </configuration>
  17.             <executions>
  18.                 <execution>
  19.                     <id>tomcat-startup</id>
  20.                     <goals>
  21.                         <goal>run-war-only</goal>
  22.                     </goals>
  23.                     <phase>pre-integration-test</phase>
  24.                     <configuration>
  25.                         <fork>true</fork>
  26.                         <systemProperties>
  27.                             <JAVA_OPTS>-javaagent:C:/Users/Administrator/.m2/repository/org/jacoco/org.jacoco.agent/0.7.0.201403182114/org.jacoco.agent-0.7.0.201403182114-runtime.jar=destfile=D:/02WORKSPACE/ywry/04web/target/jacoco/jacoco.exec</JAVA_OPTS>
  28.                         </systemProperties>
  29.                     </configuration>
  30.                 </execution>
  31.                 <execution>
  32.                     <id>tomcat-shutdown</id>
  33.                     <goals>
  34.                         <goal>shutdown</goal>
  35.                     </goals>
  36.                     <phase>post-integration-test</phase>
  37.                 </execution>
  38.             </executions>
  39.         </plugin>
  40.         <plugin>
  41.             <groupId>org.codehaus.mojo</groupId>
  42.             <artifactId>selenium-maven-plugin</artifactId>
  43.             <version>2.3</version>
  44.             <executions>
  45.                 <execution>
  46.                     <id>start</id>
  47.                     <phase>pre-integration-test</phase>
  48.                     <goals>
  49.                         <goal>start-server</goal>
  50.                     </goals>
  51.                     <configuration>
  52.                         <background>true</background>
  53.                         <logOutput>true</logOutput>
  54.                         <multiWindow>true</multiWindow>
  55.                     </configuration>
  56.                 </execution>
  57.                 <execution>
  58.                     <id>stop</id>
  59.                     <phase>post-integration-test</phase>
  60.                     <goals>
  61.                         <goal>stop-server</goal>
  62.                     </goals>
  63.                 </execution>
  64.             </executions>
  65.         </plugin>
复制代码



作者: qqq911    时间: 2019-3-1 10:38
换个工具
作者: abcsell    时间: 2019-3-1 10:42
maven自己不可能关闭Tomcat,去服务器里用命令吧
作者: jingzizx    时间: 2019-3-1 12:53
关闭Tomcat要自己写脚本吧




欢迎光临 51Testing软件测试论坛 (http://bbs.51testing.com/) Powered by Discuz! X3.2