How to run @RunWith(Cucumber.class) step by step

yeniden picture yeniden · Nov 21, 2014 · Viewed 15.4k times · Source

I'm working on a BDD file and trying to test with JUnit.

I want to use RunCukesTest class with @RunWith(Cucumber.class).

I've searched on many websites about how to install requirements, but I couldn't find any website which explains it briefly, step by step.

Could you explain me briefly, step by step, how can I run my test?

package test.newtest;

import cucumber.junit.Cucumber;
import org.junit.runner.RunWith;

@RunWith(Cucumber.class)
public class RunCukesTest {
}

Answer

Jim Barton picture Jim Barton · May 27, 2015

Cucumber will default to looking for feature files under the same package as RunCucksTest. You can also change the location(s) it will look for feature files by supplying the "features" option with the @CucumberOptions annotation (in RunCucksTest). E. g.,

@CucumberOptions(strict = true,  features = {
        "src/test/resources/cucumber/",
    },monochrome=true)