I have a fairly simple Cucumber test framework with a feature file, a step definitions file, and a test runner class that looks like this:
@RunWith(Cucumber.class)
@CucumberOptions(features = "src/test/java/com/tests/cucumber/features/ui/ExampleTest.feature",
glue = { "com.tests.cucumber.stepdefinitions" },
)
public class ExampleTestRunner {
}
This runs a scenario in the feature file just fine. Now I want to add a Before and After hook to do some setup and teardown, but I can't for the like of me get the hooks to run. I've tried adding the hooks to the ExampleTestRunner and to the StepDefinition class, but they never run. Where should I put these hooks? At the moment, the hooks just look like this, but I'll add content to them once I've worked this out!
@Before
public void beforeClass(Scenario scenario) {
System.out.println("starting beforeClass()");
}
Thanks for any help.
Aucun commentaire:
Enregistrer un commentaire