Pages

What is cucumber dry-run?

What is cucumber dry-run?

Cucumber dry-run:
  • dryRun is one of the command which can be passed in cucumberOptions().
  • It is used to check whether all feature files have corresponding steps definitions or not. 
  • It will just compile and validate your code/script file.
  • If any step definitions not found it will throw message.
dryRun will take 2 values:

False:
  • Its default value is false.
  • It will compile feature files and throw a message if any step definition(s) not found
True:
  • If dryRun value is true, then its glue code execution should be skipped
Demo on Cucumber dryRun:

Let's say I have a sample scenario like below:
cucumber dry run
cucumber dry run
FirstFeatureFile.feature
Scenario: This is First Scenario
  Given I am in First step with step def implementation in First Scenario
  And I am in Second step without step def implementation
And it's step definitions are:
@Given("I am in First step with step def implementation in First Scenario")
public void iAmInFirstStepWithStepDefImplementationInFirstScenario() {
    System.out.println("Iam in First scenario");
}
In above scenario, Given step have step definition and And step doesn't have step definition.
Run scenario with dryRun option:
cucumber dry run
Cucumber dryRun=false
cucumber dry run
Cucumber dryRun=true
Please comment below to feedback or ask questions.

No comments:

Post a Comment

Please comment below to feedback or ask questions.