Class Cucumber
- All Implemented Interfaces:
Describable,Filterable,Orderable,Sortable
A class annotated with @RunWith(Cucumber.class) will run feature
files as junit tests. In general, the runner class should be empty without
any fields or methods. For example:
@RunWith(Cucumber.class)
@CucumberOptions(plugin = "pretty")
public class RunCucumberTest {
}
By default Cucumber will look for .feature and glue files on the
classpath, using the same resource path as the annotated class. For example,
if the annotated class is com.example.RunCucumber then features and
glue are assumed to be located in com.example.
Options can be provided in by (order of precedence):
- Properties from
System.getProperties()()} - Properties from in
System.getenv() - Annotating the runner class with
CucumberOptions - Properties from "cucumber.properties"
Constants.
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.
- See Also:
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected StatementchildrenInvoker(RunNotifier notifier) Deprecated.protected DescriptiondescribeChild(ParentRunner<?> child) Deprecated.protected List<ParentRunner<?>>Deprecated.protected voidrunChild(ParentRunner<?> child, RunNotifier notifier) Deprecated.voidsetScheduler(RunnerScheduler scheduler) Deprecated.Methods inherited from class org.junit.runners.ParentRunner
classBlock, classRules, collectInitializationErrors, createTestClass, filter, getDescription, getName, getRunnerAnnotations, getTestClass, isIgnored, order, run, runLeaf, sort, validatePublicVoidNoArgMethods, withAfterClasses, withBeforeClasses, withInterruptIsolation
-
Constructor Details
-
Cucumber
Deprecated.Constructor called by JUnit.- Parameters:
clazz- the class with the @RunWith annotation.- Throws:
InitializationError- if there is another problem
-
-
Method Details
-
getChildren
Deprecated.- Specified by:
getChildrenin classParentRunner<ParentRunner<?>>
-
describeChild
Deprecated.- Specified by:
describeChildin classParentRunner<ParentRunner<?>>
-
runChild
Deprecated.- Specified by:
runChildin classParentRunner<ParentRunner<?>>
-
childrenInvoker
Deprecated.- Overrides:
childrenInvokerin classParentRunner<ParentRunner<?>>
-
setScheduler
Deprecated.- Overrides:
setSchedulerin classParentRunner<ParentRunner<?>>
-
cucumber-junit-platform-engine.