0
votes

I have to following project structure:

The directory src/test/java/ic/tests contains junit tests and the directory src/test/features/ic contains cucumber test (feature files).

But when I do a maven run (mvn test -Dcucumber.options="src/test/features/ic --tags @IC-115") to execute a single cucumber test the executor starts the junit tests in the src/test/java/ic/tests directory...

Only the corresponding feature file is annotated with @IC-115.

Even the absolute version mvn test -Dcucumber.options="C:\Users_Clemens_\Documents\test-ic\src\test\resources\features\ic\IC-115-LogOut.feature" does not execute my test.

How can I execute the single cucumber test that I want to execute?

enter image description here

enter image description here

2

2 Answers

0
votes

Could solve it by adding a runner class AND moved feature files to "src/test/resources" AND added the maven-surefire-plugin with adding an exclusion to the runner class. Seems like these 3 steps are all necessary.

package kiwigrid;

import org.junit.runner.RunWith;

import cucumber.api.CucumberOptions;
import cucumber.api.junit.Cucumber;

@RunWith(Cucumber.class)
@CucumberOptions(features="src/test/resources")
public class Runner {

}

enter image description here

0
votes

Try to run the command with the name of the feature (exact way to the feature).

mvn test -Dcucumber.options="src/test/features/ic/FeatureName.feature"

Or if the feature is composed by more than one test you could set a specific(not used for others scenarios) tag to the test and run with

mvn verify -Dcucumber.options="--tags @specifictag"