Forum Discussion

ajithkumar's avatar
ajithkumar
Regular Visitor
3 years ago

Rerun failed scenarios - cucumber-java(7.2.3)

Hi,

Tried Options:

https://community.smartbear.com/t5/Cucumber-Open/rerun-failed-scenarios/td-p/215855.

https://www.youtube.com/watch?v=8eD_bg1h16M&lc=UgyQpoD7AkCUKAzo0NB4AaABAg.9M6ptpbJ8J29M6swjAXtJh

But couldn't able to run the scenarios.

Problem statement:

1. rerun failed scenarios after the first runner executes/Immediately.

2. create cucumber report

3. merge report

 

 

package parallel.runner;

import io.cucumber.junit.Cucumber;
import io.cucumber.junit.CucumberOptions;
import org.junit.runner.RunWith;

import static io.cucumber.junit.CucumberOptions.SnippetType.CAMELCASE;

@RunWith(Cucumber.class)
@CucumberOptions(
        features = "src/test/resources/parallel",
        glue = "classpath:parallel",
        plugin = {"pretty",
                "summary",
                "html:target/cucumber-reports/index.html",
                "json:target/cucumber.json",
                "rerun:target/rerun.txt"},
        snippets = CAMELCASE,
        monochrome = true
)
public class ApiRunCucumberIT {

}
package parallel.runner;

import io.cucumber.junit.Cucumber;
import io.cucumber.junit.CucumberOptions;
import org.junit.runner.RunWith;

import static io.cucumber.junit.CucumberOptions.SnippetType.CAMELCASE;

@RunWith(Cucumber.class)
@CucumberOptions(
        features = {"@target/rerun.txt"},
        glue = {"classpath:parallel"},
        plugin = {"pretty",
                "summary",
                "html:target/cucumber-rerun-reports/index.html",
                "json:target/rerun-cucumber.json"},
        snippets = CAMELCASE,
        monochrome = true
)
public class ReRunCucumberIT {
}
<plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-failsafe-plugin</artifactId>
                <version>3.0.0-M5</version>
                <executions>
                    <execution>
                        <id>integration-tests</id>
                        <goals>
                            <goal>integration-test</goal>
                            <goal>verify</goal>
                        </goals>
                        <configuration>
                            <parallel>methods</parallel>
                            <threadCount>10</threadCount>
                            <perCoreThreadCount>false</perCoreThreadCount>
                            <forkCount>1</forkCount>
                            <reuseForks>true</reuseForks>
                            <systemPropertyVariables>
                                <hostName>${host.name}</hostName>
                                <cucumber.features>classpath:${feature.source.folder}</cucumber.features>
                                <cucumber.filter.tags>${cucumber.filter.tags}</cucumber.filter.tags>
                            </systemPropertyVariables>
                        </configuration>
                    </execution>
                </executions>
            </plugin>

            <plugin>
                <groupId>net.masterthought</groupId>
                <artifactId>maven-cucumber-reporting</artifactId>
                <version>5.6.2</version>
                <executions>
                    <execution>
                        <id>execution</id>
                        <phase>verify</phase>
                        <goals>
                            <goal>generate</goal>
                        </goals>
                        <configuration>
                            <projectName>document-tests</projectName>
                            <outputDirectory>${project.build.directory}</outputDirectory>
                            <inputDirectory>${project.build.directory}</inputDirectory>
                            <jsonFiles>
                                <!-- supports wildcard or name pattern -->
                                <param>**/*cucumber.json</param>
                            </jsonFiles>
                            <skippedFails>true</skippedFails>
                            <buildNumber>1</buildNumber>
                        </configuration>
                    </execution>
                </executions>
            </plugin>
        </plugins>

 

 

Please provide the working solutions. 

Suggestion: I think it would be better, cucumber has developed this feature & updated documentation.

Thank you,

Ajith.

 

No RepliesBe the first to reply