Problem: During long work with the Automation test framework we collect multiple cases and even greater number of test steps. And we had no automatic mechanism to validate/check if all the steps:
1. are still used (maybe some are obsolete/redundant/deprecated)
2. are valid in test cases ('missing step definition')
Solution: To do some garbage clean with found implemented plugin - add a special test class with dryRun option and plugin unused:
@RunWith(Cucumber.class)
@CucumberOptions(
dryRun = true,
features = "src/main/resources/",
glue = "com.prosper.test.automation",
monochrome = true,
plugin = "unused:target/unused.log")
public class CheckMissingCucumberStepsRunner {
}To compile it successfully, need add corresponding dependencies:
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
</dependency>
<dependency>
<groupId>io.cucumber</groupId>
<artifactId>cucumber-junit</artifactId>
<version>7.2.3</version>
<scope>test</scope>
</dependency>(number of failed tests will be available right on 'Run' panel in Idea; number of unused steps will be listed in target/unused.log file with list of all unused steps)