Annotations used in cucumber-jvm


@Runwith :

Classes annotated with @RunWith(Cucumber.class) will run a Cucumber Feature. The class should be empty without any fields or methods.

Cucumber will look for a .feature file on the classpath, using the same resource path as the annotated class (.class substituted by .feature).

Additional hints can be given to Cucumber by annotating the class with CucumberOptions.

@CucumberOptions : This annotation provides the same options as the cucumber jvm command line. we can specify the path to feature files, path to step definitions

Options in @CucumberOptions :

1.dryRun : If its ‘true’ then it will Skip the execution of glue code

2.strict : If its ‘true’ then it will fail the execution if there are undefined or pending steps.

3.features : The paths to the feature(s) files which has the spec.

4.glue : This tells where to look for glue code (stepdefs and hooks)

5.tags : This tells Which tags in the features should be executed.

6.format : Generally for reporting purpose.Anyway this is deprecated.

7.plugin : Reporting purpose.(what plugins(s) to use).

8.snippets : what format should the snippets use. underscore, camelcase

Types of Reports

HTML: This will generate a HTML report at the location mentioned in the plugin .

Syntax: plugin= {“pretty”, “html:target/cucumber”}

A report will be generated in the target folder when you execute it.

JSON: This report contains all the information from the gherkin source in JSON Format. This report is meant to be post-processed into another visual
format by 3rd party tools such as Cucumber Jenkins.

Syntax: plugin= {
“json:target_json/cucumber.json”,
}

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s