Cucumber: Feature file is unable to find step definitions when they are in separate modules

40 Views Asked by At

I am unable to map the feature file to the step definition one which is in different module.

The project is split between two Java modules, in the firts one are the feature files and the runner and in the second one the steps and the definitions of the tests.

This is part of runner that I'm currently using:

@RunWith ( CucumberWithSerenity.class )
@CucumberOptions ( features = "features/", glue = { "com.kps.api.steps.definitions" }, tags = "@API"
    ,plugin = { "pretty", "json:target/cucumber-reports/Cucumber.json" },
    monochrome = true)

And this is the project structure

-API_TESTING
--.idea
--api-testing (First module)
 --feature
   --feature.file
 --src
   --java
     --Runner.class

--rest-commons (second module)
  --src
    --main
      --java
        --definitions

I was trying different "glue" options in the runner, but the result is the same:

io.cucumber.junit.UndefinedStepException: The step "testing step" is undefined.
You can implement this step using the snippet bellow:

If I place the step definition in the same module as the feature file the it's working normally.

0

There are 0 best solutions below