You can throw the cucumber.api.PendingException
from the matching stepdefinition method. This will show up the scenario as pending. For getting these pending stepdefinition easily use dryRun=true
in the cucumberoptions of the runner.
For the below feature file.
Scenario: Run Pending scenario
Given step one
When step two
Then step three
Scenario: Run Defined scenario
Given step one defined
When step two defined
Then step three defined
Sample stepdefinition
@Given("^step one$")
public void stepOne() {
// Write code here that turns the phrase above into concrete actions
throw new PendingException();
}
The result will show up as below. The 'steps' section will show only the first step as pending and the remaining as skipped. Though the 'scenario' section gives the pending scenario status as a whole.
2 Scenarios (1 pending, 1 passed)
6 Steps (2 skipped, 1 pending, 3 passed)