Wednesday, August 1, 2018

Cucumber Options

To execute the Cucumber test, you have to configure features and glue to Cucumber runner.

package me.simplejavautomation;

import org.junit.runner.RunWith;

import cucumber.api.CucumberOptions;
import cucumber.api.junit.Cucumber;

@RunWith(Cucumber.class)
@CucumberOptions(features = "src/test/features",
    glue = { "me.simplejavautomation.stepdefs"})
public class CucumberTestRunner {

}

Here is the diagram of CucumberOptions annotation.

dryRun -- show steps if don't have step definition.
features -- the paths of feature files.
glue -- the classpath of step definition files.
tags -- specify which tags in feature files should be executed.
monochrome -- display console output in the much readable way.
plugin -- specify different formatting options for the output reports.
strict -- if strict mode is enabled (fail if there are undefined or pending steps).
name -- specify a pattern filter for features or scenarios
snippets -- what format should the snippets use. underscore, camelcase.
junit -- the options for the JUnit runner.

No comments:

Post a Comment