0
votes

When I run to run this test with a feature it complains it cannot find the steps. I have tried defining them in Java 8 style, and Java 7 style and using IntelliJ to generate the steps into a MyStepdefs class but it cannot find them.

I am using version 1.2.4 of cucumber-java8 and cucumber-junit.

import cucumber.api.CucumberOptions;
import cucumber.api.DataTable;
import cucumber.api.PendingException;
import cucumber.api.java8.En;
import cucumber.api.junit.Cucumber;
import org.junit.runner.RunWith;

@RunWith(Cucumber.class)
@CucumberOptions(
        monochrome = true,
        glue = {"com.mycom.core.agg.RunCukesTest"})
public class RunCukesTest implements En {

    public RunCukesTest() {
        Given("^I have PriceLevels$", (DataTable arg1) -> {
        });

        And("^I have a TradeRequest$", (DataTable arg1) -> {
        });

        Then("^I should get these LegRequests$", (DataTable arg1) -> {
        });
    }
}

running the test prints

Running com.mycom.core.agg.RunCukesTest

1 Scenarios (1 undefined)
3 Steps (3 undefined)
0m0.000s


You can implement missing steps with the snippets below:

Given("^I have PriceLevels$", (DataTable arg1) -> {
.. rest deleted ...

Running the feature file from IntelliJ give much the same error.

1

1 Answers

1
votes

While we couldn't figure out what the cause was, create a new maven project with a minimum of dependencies "fixed" the problem. We didn't need to change the code.