What is Cucumber?
Cucumber is an open-source software testing tool that uses natural language to automate acceptance tests and support behavior-driven development.
Enabling XML Output
Cucumber has built in support for producing JUnit compatible XML output. It can be enabled from the command line with the --format
command line option. To generate the report file at output/report.xml
use a command line like this:
1cucumber tests/test.feature --format junit:output/report.xml
Test Suite naming
Cucumber's JUnit report formatter has limited configuration, but it does let you set the testsuite
s name
attribute. You can set it in the config file or on the command line like this:
1cucumber --format junit:out.xml --format-options='{"junit": {"suiteName":"mySuite"} }'
The --format-options
setting must be JSON that is escaped using single quotes. For more details see the Cucumber Reporting documentation.
Handling Retries
Cucumber can retry tests using the retry
field of the config file or the --retry
command line argument.
1cucumber-js --retry 3
If you need to retry a lot of tests that is a strong indicator that you may have flaky tests. These are tests that sometimes pass and sometimes fail, slowing down your development process. You can get early access to Trunk’s new Flaky Tests tool to manage these types of tests better.