maven重新运行,运行所有场景,而不是失败的场景

u1ehiz5o  于 2021-08-25  发布在  Java
关注(0)|答案(0)|浏览(438)

我有以下跑步课程:

  1. @CucumberOptions(
  2. features = {"src/test/java/resources/features/"},
  3. glue = {"stepDefinition"},
  4. monochrome = true,
  5. tags = "@Test",
  6. plugin = {"pretty", "junit:target/cucumber-junitReports/Cucumber.xml", "html:target/cucumber-htmlReports" + ".html", "json:target/cucumber-report/cucumber.json","json:target/cucumber-jsonReports/report.json","rerun:target/rerun.txt"})

然后,我使用 mvn test -Dcucumber.filter.tags=@Test . 如果测试失败,它们将写入rerun.txt文件。
然后我就跑 mvn clean test -Dcucumber.options="@rerun.txt" -Dcucumber.filter.tags=@$Test 但我注意到它运行的所有测试都带有 @Test 标记,而不是rerun.txt文件中失败的标记。我的rerun.txt文件如下所示 file:src/test/java/resources/features/project/game/gamepage.feature:15 不知道是否有必要,但我会包括我的pom文件。

  1. <project xmlns="http://maven.apache.org/POM/4.0.0"
  2. xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
  3. xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
  4. <modelVersion>4.0.0</modelVersion>
  5. <groupId>Automation</groupId>
  6. <artifactId>Project</artifactId>
  7. <version>0.0.1-SNAPSHOT</version>
  8. <name>Game Automation</name>
  9. <description>GameAutomation Project</description>
  10. <packaging>jar</packaging>
  11. <properties>
  12. <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
  13. </properties>
  14. <build>
  15. <pluginManagement>
  16. <plugins>
  17. <plugin>
  18. <groupId>org.apache.maven.plugins</groupId>
  19. <artifactId>maven-compiler-plugin</artifactId>
  20. <version>3.8.1</version>
  21. <configuration>
  22. <source>1.8</source>
  23. <target>1.8</target>
  24. <fork>true</fork>
  25. <!--<executable>C:\Program Files\Java\jdk1.8.0_121\bin\javac.exe</executable> -->
  26. <executable>${env.JAVA_HOME}\bin\javac.exe</executable>
  27. </configuration>
  28. </plugin>
  29. <plugin>
  30. <groupId>org.apache.maven.plugins</groupId>
  31. <artifactId>maven-surefire-plugin</artifactId>
  32. <version>3.0.0-M3</version>
  33. <configuration>
  34. <includes>
  35. <include>**/*Rerun.java</include>
  36. </includes>
  37. <rerunFailingTestsCount>2</rerunFailingTestsCount>
  38. <suiteXmlFiles>
  39. <suiteXmlFile>testng.xml</suiteXmlFile>
  40. </suiteXmlFiles>
  41. <testFailureIgnore>true</testFailureIgnore>
  42. </configuration>
  43. </plugin>
  44. <plugin>
  45. <groupId>com.trivago.rta</groupId>
  46. <artifactId>cluecumber-report-plugin</artifactId>
  47. <version>2.6.1</version>
  48. <executions>
  49. <execution>
  50. <id>report</id>
  51. <phase>post-integration-test</phase>
  52. <goals>
  53. <goal>reporting</goal>
  54. </goals>
  55. </execution>
  56. </executions>
  57. <configuration>
  58. <customPageTitle>Automated Test Results</customPageTitle>
  59. <customParameters>
  60. <Custom_Parameter>Automated Test Results</Custom_Parameter>
  61. <_Text>Results ForAutomated Test Results</_Text>
  62. </customParameters>
  63. <expandBeforeAfterHooks>true</expandBeforeAfterHooks>
  64. <sourceJsonReportDirectory>${project.build.directory}/cucumber-report</sourceJsonReportDirectory>
  65. <generatedHtmlReportDirectory>${project.build.directory}/generated-report</generatedHtmlReportDirectory>
  66. </configuration>
  67. </plugin>
  68. </plugins>
  69. </pluginManagement>
  70. </build>
  71. <dependencies>
  72. <dependency>
  73. <groupId>org.seleniumhq.selenium</groupId>
  74. <artifactId>selenium-java</artifactId>
  75. <version>4.0.0-beta-3</version>
  76. </dependency>
  77. <!-- https://mvnrepository.com/artifact/org.junit.jupiter/junit-jupiter-api -->
  78. <dependency>
  79. <groupId>org.junit.jupiter</groupId>
  80. <artifactId>junit-jupiter-api</artifactId>
  81. <version>5.7.0</version>
  82. <scope>test</scope>
  83. </dependency>
  84. <!-- https://mvnrepository.com/artifact/io.cucumber/cucumber-java -->
  85. <dependency>
  86. <groupId>io.cucumber</groupId>
  87. <artifactId>cucumber-java</artifactId>
  88. <version>6.9.1</version>
  89. </dependency>
  90. <!-- https://mvnrepository.com/artifact/io.cucumber/cucumber-junit -->
  91. <dependency>
  92. <groupId>io.cucumber</groupId>
  93. <artifactId>cucumber-junit</artifactId>
  94. <version>6.9.1</version>
  95. <scope>test</scope>
  96. </dependency>
  97. <!-- https://mvnrepository.com/artifact/io.cucumber/cucumber-core -->
  98. <dependency>
  99. <groupId>io.cucumber</groupId>
  100. <artifactId>cucumber-core</artifactId>
  101. <version>6.9.1</version>
  102. </dependency>
  103. <!-- https://mvnrepository.com/artifact/io.cucumber/cucumber-html -->
  104. <dependency>
  105. <groupId>io.cucumber</groupId>
  106. <artifactId>cucumber-html</artifactId>
  107. <version>0.2.7</version>
  108. </dependency>
  109. <!-- https://mvnrepository.com/artifact/io.cucumber/cucumber-jvm-deps -->
  110. <dependency>
  111. <groupId>io.cucumber</groupId>
  112. <artifactId>cucumber-jvm-deps</artifactId>
  113. <version>1.0.6</version>
  114. <scope>provided</scope>
  115. </dependency>
  116. <!-- https://mvnrepository.com/artifact/io.cucumber/gherkin -->
  117. <dependency>
  118. <groupId>io.cucumber</groupId>
  119. <artifactId>gherkin</artifactId>
  120. <version>16.0.0</version>
  121. </dependency>
  122. <!-- https://mvnrepository.com/artifact/io.cucumber/cucumber-picocontainer -->
  123. <dependency>
  124. <groupId>io.cucumber</groupId>
  125. <artifactId>cucumber-picocontainer</artifactId>
  126. <version>6.9.1</version>
  127. <scope>test</scope>
  128. </dependency>
  129. <!-- https://mvnrepository.com/artifact/io.cucumber/cucumber-testng -->
  130. <dependency>
  131. <groupId>io.cucumber</groupId>
  132. <artifactId>cucumber-testng</artifactId>
  133. <version>6.9.1</version>
  134. </dependency>
  135. <!-- https://mvnrepository.com/artifact/com.aventstack/extentreports -->
  136. <dependency>
  137. <groupId>com.aventstack</groupId>
  138. <artifactId>extentreports</artifactId>
  139. <version>5.0.6</version>
  140. </dependency>
  141. <dependency>
  142. <groupId>com.vimalselvam</groupId>
  143. <artifactId>cucumber-extentsreport</artifactId>
  144. <version>3.1.1</version>
  145. </dependency>
  146. <dependency>
  147. <groupId>com.aventstack</groupId>
  148. <artifactId>extentreports-cucumber4-adapter</artifactId>
  149. <version>1.2.1</version>
  150. <exclusions>
  151. <exclusion>
  152. <groupId>io.cucumber</groupId>
  153. <artifactId>cucumber-java</artifactId>
  154. </exclusion>
  155. </exclusions>
  156. <scope>test</scope>
  157. </dependency>
  158. <!-- https://mvnrepository.com/artifact/org.freemarker/freemarker -->
  159. <dependency>
  160. <groupId>org.freemarker</groupId>
  161. <artifactId>freemarker</artifactId>
  162. <version>2.3.30</version>
  163. </dependency>
  164. <!-- https://mvnrepository.com/artifact/net.masterthought/cucumber-reporting -->
  165. <dependency>
  166. <groupId>net.masterthought</groupId>
  167. <artifactId>cucumber-reporting</artifactId>
  168. <version>5.4.0</version>
  169. </dependency>
  170. <!-- https://mvnrepository.com/artifact/io.cucumber/cucumber-java8 -->
  171. <dependency>
  172. <groupId>io.cucumber</groupId>
  173. <artifactId>cucumber-java8</artifactId>
  174. <version>6.9.1</version>
  175. </dependency>
  176. <dependency>
  177. <groupId>com.trivago.rta</groupId>
  178. <artifactId>cluecumber-report-plugin</artifactId>
  179. <version>2.6.1</version>
  180. </dependency>
  181. <dependency>
  182. <groupId>ru.yandex.qatools.ashot</groupId>
  183. <artifactId>ashot</artifactId>
  184. <version>1.5.4</version>
  185. </dependency>
  186. <!-- https://mvnrepository.com/artifact/io.appium/java-client -->
  187. <dependency>
  188. <groupId>io.appium</groupId>
  189. <artifactId>java-client</artifactId>
  190. <version>7.5.1</version>
  191. </dependency>
  192. <!-- https://mvnrepository.com/artifact/org.json/json -->
  193. <dependency>
  194. <groupId>org.json</groupId>
  195. <artifactId>json</artifactId>
  196. <version>20210307</version>
  197. </dependency>
  198. <dependency>
  199. <groupId>org.apache.logging.log4j</groupId>
  200. <artifactId>log4j-api</artifactId>
  201. <version>2.13.3</version>
  202. </dependency>
  203. <dependency>
  204. <groupId>org.apache.logging.log4j</groupId>
  205. <artifactId>log4j-core</artifactId>
  206. <version>2.13.3</version>
  207. </dependency>
  208. <dependency>
  209. <groupId>org.apache.logging.log4j</groupId>
  210. <artifactId>log4j-slf4j-impl</artifactId>
  211. <version>2.13.3</version>
  212. </dependency>
  213. <!-- https://mvnrepository.com/artifact/org.seleniumhq.selenium/selenium-api -->
  214. <dependency>
  215. <groupId>org.seleniumhq.selenium</groupId>
  216. <artifactId>selenium-api</artifactId>
  217. <version>4.0.0-beta-3</version>
  218. </dependency>
  219. <!-- https://mvnrepository.com/artifact/org.seleniumhq.selenium/selenium-support -->
  220. <dependency>
  221. <groupId>org.seleniumhq.selenium</groupId>
  222. <artifactId>selenium-support</artifactId>
  223. <version>4.0.0-beta-3</version>
  224. </dependency>
  225. <!-- https://mvnrepository.com/artifact/org.seleniumhq.selenium/selenium-chrome-driver -->
  226. <dependency>
  227. <groupId>org.seleniumhq.selenium</groupId>
  228. <artifactId>selenium-chrome-driver</artifactId>
  229. <version>4.0.0-beta-3</version>
  230. </dependency>
  231. <!-- https://mvnrepository.com/artifact/org.seleniumhq.selenium/selenium-json -->
  232. <dependency>
  233. <groupId>org.seleniumhq.selenium</groupId>
  234. <artifactId>selenium-json</artifactId>
  235. <version>4.0.0-beta-3</version>
  236. </dependency>
  237. </dependencies>
  238. </project>

我已经尝试了以下被接受的答案和这个答案,但它运行所有的测试。是否有我遗漏的东西,或者有更好的重播方式。?

暂无答案!

目前还没有任何答案,快来回答吧!

相关问题