Skip to content

A maven plugin to generate failed cucumber runner classes after the build so that the CI tool can launch another build to retest only the failed scenarios

License

Notifications You must be signed in to change notification settings

anoop5i/reruncuke-plugin

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

30 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Build Status Maven Central License

reruncuke-plugin

This plugin generates cucumber runner classes from the txt files generated by rerun plugin.

Usage

Example

      <plugin>
           <groupId>io.github.anoopsivarajan</groupId>
           <artifactId>reruncuke-plugin</artifactId>
           <version>1.0.2</version>
           <configuration>
              <packageName>com.test.failed</packageName>
              <glue>com.app.auto</glue>
              <jsonPath>${project.build.directory}/cucumber-parallel/</jsonPath>
              <type>SERENITY</type>
           </configuration>
       </plugin>

The above configuration generate the runner classes with name 'FailedRunner*.java' in the com.test.failed package.

Types

Runner class definition changes based on the type selected in the configuration. Following are the available types.

  • JUNIT - selects the class template with @RunWith(Cucumber.class)
  • SERENITY - selects the class template with @RunWith(CucumberSerenity.class)
Usage with cucumber-jvm-parallel-plugin and Jenkins
Turn off delete workspace at build starts property in the build configuration.

Setup the plugins json and rerun in the cucumber-jvm-parallel-plugin

      <plugins>
           <plugin>
              <name>json</name>
          </plugin>
          <plugin>
              <name>rerun</name>
           </plugin>
      </plugins>

Replace the include class with a variable in the surefire plugin to substitute with class name at build startup.

        <includes>
            <include>**/${runner}.java</include>
        </includes>

Add another invoke maven top level target in the build command after the integration tests.

 mvn reruncuke:generate

On first run substitute with naming pattern used in the cucumber-jvm-parallel-plugin.

-Drunner=*IT.java //Example: if naming pattern is the default Parallel{c}IT

If there are failures in the current build the plugin will generate separate failed runner classes for each FEATURE or SCENARIO depending on the configuration in the cucumber-jvm-parallel-plugin.

To run only the failed scenarios in parallel or in a single thread invoke another build but this substitute the runner varaible with "FailedRunner*.java"

-Drunner=FailedRunner*.java

This way you can launch as many builds you want with only the failed scenarios and at the end of each build the plugin will regenerate the failed classes for the next run. You can commit the failed runner files into git in case if you prefer deleting the workspace prior to the build action.

About

A maven plugin to generate failed cucumber runner classes after the build so that the CI tool can launch another build to retest only the failed scenarios

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages