Closed alinpa closed 5 years ago
Any update about this?
https://maven.apache.org/surefire/maven-surefire-plugin/examples/rerun-failing-tests.html
NOTE : This feature is supported only for JUnit 4.x.
even though if we provide testNG is false and just provided TestNG Dependencies then also rerunTestCases count is not working. Please find below POM.xml and the console POM: <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">
<groupId>cucumber</groupId>
<artifactId>cucumber-java-skeleton</artifactId>
<version>0.0.1</version>
<packaging>jar</packaging>
<name>Cucumber-Java Skeleton</name>
<properties>
<java.version>1.8</java.version>
<junit.version>4.12</junit.version>
<cucumber.version>3.0.0</cucumber.version>
<cucumber.pro.version>2.0.4</cucumber.pro.version>
<maven.compiler.version>3.3</maven.compiler.version>
<surefire.rerunFailingTestsCount>2</surefire.rerunFailingTestsCount>
</properties>
<dependencies>
<dependency>
<groupId>io.cucumber</groupId>
<artifactId>cucumber-java</artifactId>
<version>${cucumber.version}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>io.cucumber</groupId>
<artifactId>cucumber-junit</artifactId>
<version>${cucumber.version}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>io.cucumber</groupId>
<artifactId>pro-plugin</artifactId>
<version>${cucumber.pro.version}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>${junit.version}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>io.cucumber</groupId>
<artifactId>cucumber-testng</artifactId>
<version>3.0.0</version>
</dependency>
<dependency>
<groupId>org.testng</groupId>
<artifactId>testng</artifactId>
<version>6.9.8</version>
<scope>test</scope>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>com.github.temyers</groupId>
<artifactId>cucumber-jvm-parallel-plugin</artifactId>
<version>5.0.0</version>
<executions>
<execution>
<id>generateRunners</id>
<phase>generate-test-sources</phase>
<goals>
<goal>generateRunners</goal>
</goals>
<configuration>
<!-- Mandatory -->
<!-- List of package names to scan for glue code. -->
<glue>
<package>skeleton</package>
</glue>
<!-- These are optional, with the default values -->
<!-- Where to output the generated tests -->
<outputDirectory>${project.build.directory}/generated-test-sources/cucumber</outputDirectory>
<!-- The directory, which must be in the root of the runtime classpath, containing your feature files. -->
<featuresDirectory>src/test/resources/</featuresDirectory>
<!-- Directory where the cucumber report files shall be written -->
<cucumberOutputDir>target/cucumber-parallel</cucumberOutputDir>
<!-- List of cucumber plugins. When none are provided the json formatter is used. For more
advanced usage see section about configuring cucumber plugins -->
<plugins>
<plugin>
<name>json</name>
</plugin>
</plugins>
<!-- CucumberOptions.strict property -->
<strict>true</strict>
<!-- CucumberOptions.monochrome property -->
<monochrome>true</monochrome>
<!-- The tags to run, maps to CucumberOptions.tags property. Default is no tags. -->
<tags>
<tag>@belly</tag>
</tags>
<!-- Generate TestNG runners instead of JUnit ones. -->
<useTestNG>false</useTestNG>
<!-- The naming scheme to use for the generated test classes. One of ['simple', 'feature-title', 'pattern'] -->
<namingScheme>simple</namingScheme>
<!-- The class naming pattern to use. Only required/used if naming scheme is 'pattern'.-->
<namingPattern>Parallel{c}IT</namingPattern>
<!-- One of [SCENARIO, FEATURE]. SCENARIO generates one runner per scenario. FEATURE generates a runner per feature. -->
<parallelScheme>SCENARIO</parallelScheme>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>2.22.0</version>
<executions>
<execution>
<id>acceptance-test</id>
<phase>integration-test</phase>
<goals>
<goal>test</goal>
</goals>
<configuration>
<forkCount>1</forkCount>
<includes>
<include>**/*IT.java</include>
</includes>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>${maven.compiler.version}</version>
<configuration>
<encoding>UTF-8</encoding>
<source>${java.version}</source>
<target>${java.version}</target>
<compilerArgument>-Werror</compilerArgument>
</configuration>
</plugin>
</plugins>
</build>
Console: [INFO] ------------------------------------------------------- [INFO] T E S T S [INFO] ------------------------------------------------------- [INFO] Running Parallel01IT
Failed scenarios: C:/Users/mshaik21/Desktop/Rerun/cucumber-java-skeleton/src/test/resources/skeleton/belly.feature:4 # a few cukes
1 Scenarios (1 failed) 1 Steps (1 failed) 0m0.038s
java.lang.ArithmeticException: / by zero at skeleton.Belly.eat(Belly.java:5) at skeleton.Stepdefs.I_have_cukes_in_my_belly(Stepdefs.java:9) at ?.I have 42 cukes in my belly(C:/Users/mshaik21/Desktop/Rerun/cucumber-java-skeleton/src/test/resources/skeleton/belly.feature:5)
[INFO] Tests run: 0, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 2.479 s - in Parallel01IT [INFO] [INFO] Results: [INFO] [INFO] Tests run: 0, Failures: 0, Errors: 0, Skipped: 0 [INFO] [WARNING] Could not delete temp directory C:\Users\mshaik21\AppData\Local\Temp\surefire7219406222818958955 because Directory C:\Users\mshaik21\AppData\Local\Temp\surefire7219406222818958955 unable to be deleted. [INFO] [INFO] --- maven-install-plugin:2.4:install (default-install) @ cucumber-java-skeleton --- [INFO] Installing C:\Users\mshaik21\Desktop\Rerun\cucumber-java-skeleton\target\cucumber-java-skeleton-0.0.1.jar to C:\Users\mshaik21.m2\repo1\m3-3.3.9\cucumber\cucumber-java-skeleton\0.0.1\cucumber-java-skeleton-0.0.1.jar [INFO] Installing C:\Users\mshaik21\Desktop\Rerun\cucumber-java-skeleton\pom.xml to C:\Users\mshaik21.m2\repo1\m3-3.3.9\cucumber\cucumber-java-skeleton\0.0.1\cucumber-java-skeleton-0.0.1.pom [INFO] ------------------------------------------------------------------------ [INFO] BUILD SUCCESS [INFO] ------------------------------------------------------------------------ [INFO] Total time: 17.537 s [INFO] Finished at: 2018-08-16T17:54:26+05:30 [INFO] Final Memory: 15M/37M [INFO] ------------------------------------------------------------------------
Process finished with exit code 0
Hello @temyers ,
I am trying to run with the following conf:
//It doesn't matter what version I have above.
I am not able to see the test which is failed to be run again. Does configure something else? Could you help me?