Overriding the Cucumber Options
Sometimes, depending on the requirements, we would like to override default Cucumber behavior, such as reporting or the project structure, and so on. We can configure Cucumber via the Terminal, but mostly we run Cucumber with JUnit. So how do we configure Cucumber with JUnit Runners, let's see this in our next section.
How to do it…
- Add
@CucumberOptions
to theRunCuckeTest.java
class and importCucumber.api.CucumberOptions
. This is how the updated code forRunCukeTest.java
should look like:package com.CucumberOptions; import org.junit.runner.RunWith; import Cucumber.api.CucumberOptions; import Cucumber.api.junit.Cucumber; @RunWith(Cucumber.class) @CucumberOptions( //your Cucumber Options code goes here ) public class ...
Get Cucumber Cookbook now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.