This is an example project on how to use the integration of Zephyr Scale and Zephyr Squad with automated tests when using Cucumber.
The integration is based on the JSON output files generated by Cucumber, so this output option needs to be configured properly.
In addition to that, scenarios can be mapped to test cases in Zephyr Scale or Zephyr Squad by using the test case key as a scenario tag: @TestCaseKey=ABC-T123
Firstly, the JSON output format for Cucumber needs to be configured on the TestRunner class:
@RunWith(Cucumber.class)
@CucumberOptions(
features = "src/test/resources/calculatorFeatures"
,glue={"com/adaptavist/tm4j/cucumberExample/stepDefinition"}
,plugin = {"junit:target/cucumber/result.xml", "json:target/cucumber/calculator.json"}
)
public class TestRunner {
}
On the example above, both JUnit XML and JSON output are enabled.
The next step is to add a tag to your scenarios @TestCaseKey=ABC-T123
or do not annotate at all, if the Test Case doesn't exist yet.
Feature: Calculator
@TestCaseKey=ABC-T123
Scenario: Add a number
Given a calculator I just turned on
And I add 4 and 4
Then the result is 8
Now, you can run your tests with mvn test
and the Cucumber execution results will be generated in target/cucumber/*.json
.