public class Cucumber
extends org.junit.runners.ParentRunner<cucumber.runtime.junit.FeatureRunner>
Classes annotated with @RunWith(Cucumber.class) will run a Cucumber Feature.
In general, the runner class should be empty without any fields or methods.
For example:
@RunWith(Cucumber.class)
@CucumberOptions(plugin = "pretty")
public class RunCukesTest {
}
Fail *
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.
Cucumber also supports JUnits ClassRule, BeforeClass and AfterClass annotations.
These will be executed before and after all scenarios. Using these is not recommended as it limits the portability
between different runners; they may not execute correctly when using the commandline, IntelliJ IDEA or
Cucumber-Eclipse. Instead it is recommended to use Cucumbers `Before` and `After` hooks.
CucumberOptions| Constructor and Description |
|---|
Cucumber(Class clazz)
Constructor called by JUnit.
|
| Modifier and Type | Method and Description |
|---|---|
protected org.junit.runners.model.Statement |
childrenInvoker(org.junit.runner.notification.RunNotifier notifier) |
protected org.junit.runner.Description |
describeChild(cucumber.runtime.junit.FeatureRunner child) |
List<cucumber.runtime.junit.FeatureRunner> |
getChildren() |
protected void |
runChild(cucumber.runtime.junit.FeatureRunner child,
org.junit.runner.notification.RunNotifier notifier) |
classBlock, classRules, collectInitializationErrors, createTestClass, filter, getDescription, getName, getRunnerAnnotations, getTestClass, isIgnored, run, runLeaf, setScheduler, sort, validatePublicVoidNoArgMethods, withAfterClasses, withBeforeClassespublic Cucumber(Class clazz) throws org.junit.runners.model.InitializationError
clazz - the class with the @RunWith annotation.org.junit.runners.model.InitializationError - if there is another problempublic List<cucumber.runtime.junit.FeatureRunner> getChildren()
getChildren in class org.junit.runners.ParentRunner<cucumber.runtime.junit.FeatureRunner>protected org.junit.runner.Description describeChild(cucumber.runtime.junit.FeatureRunner child)
describeChild in class org.junit.runners.ParentRunner<cucumber.runtime.junit.FeatureRunner>protected void runChild(cucumber.runtime.junit.FeatureRunner child,
org.junit.runner.notification.RunNotifier notifier)
runChild in class org.junit.runners.ParentRunner<cucumber.runtime.junit.FeatureRunner>protected org.junit.runners.model.Statement childrenInvoker(org.junit.runner.notification.RunNotifier notifier)
childrenInvoker in class org.junit.runners.ParentRunner<cucumber.runtime.junit.FeatureRunner>Copyright © 2019. All rights reserved.