Felipe Luz
Felipe Luz

Reputation: 43

How to run cucumber scenarios alongside other type of tests?

I have some cucumber scenarios running smoothly, but I want to run other type of tests too. Like, "test each component on the page" is not a valid scenario, because BDD is made to check behaviours. I wanted to divide cucumber scenarios AND selenium/components tests

Here's my runner:

@RunWith(Cucumber.class)
@CucumberOptions(
        monochrome = true,
        features = {"src/test/test/features/"},            
        glue = {"test.steps"},        
        tags = {""},        
        plugin = {"pretty", "com.aventstack.extentreports.cucumber.adapter.ExtentCucumberAdapter:" +
                "path"}
)

Upvotes: 0

Views: 1246

Answers (1)

Marit
Marit

Reputation: 3026

Your Cucumber tests will run at the same time as your other unit tests (*Test) or integration tests (*IT) during your build, depending on the name of your runner (which is missing from your code snippet).

Depending on whether you are using Cucumber to assert behaviour on a unit test level, or integration test level, name your runner RunCucumberTest or RunCucumberIT respectively.

For example (using the options you provided):

@RunWith(Cucumber.class)
@CucumberOptions(
        monochrome = true,
        features = {"src/test/test/features/"},            
        glue = {"test.steps"},        
        tags = {""},        
        plugin = {"pretty", "com.aventstack.extentreports.cucumber.adapter.ExtentCucumberAdapter:" +
                "path"}
)
public class RunCucumberTest {
}

Upvotes: 1

Related Questions