Maybe you could start with this simple project and then check where are the differences in yours. It could be a typo in the path, or something else we cannot know based on your provided input.
assume following structure
/tmp/cuke/tst/features/myapplication.feature
/tmp/cuke/src/test/java/runnerPackage/Runner.java
/tmp/cuke/pom.xml
myapplication.feature
Feature: test
Scenario: login
Given open firefox
And start app
When enter details
Then login happens
Runner.java
package runnerPackage;
import cucumber.api.CucumberOptions;
import cucumber.api.junit.Cucumber;
import org.junit.runner.RunWith;
@RunWith(Cucumber.class)
@CucumberOptions(
features="/tmp/cuke/tst/features/myapplication.feature",
glue={"stepdefinition"},
dryRun = false
)
public class Runner {
}
pom.xml
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0
http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>com.suboptimal</groupId>
<artifactId>cuke</artifactId>
<version>0.0.1-SNAPSHOT</version>
<packaging>jar</packaging>
<dependencies>
<dependency>
<groupId>io.cucumber</groupId>
<artifactId>cucumber-junit</artifactId>
<version>2.1.0</version>
</dependency>
<dependency>
<groupId>io.cucumber</groupId>
<artifactId>cucumber-java</artifactId>
<version>2.1.0</version>
</dependency>
</dependencies>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<maven.compiler.source>1.8</maven.compiler.source>
<maven.compiler.target>1.8</maven.compiler.target>
</properties>
</project>
run the Cucumber runner Runner
cd /tmp/cuke
mvn test -Dtest=Runner
results in
-------------------------------------------------------
T E S T S
-------------------------------------------------------
Running runnerPackage.Runner
1 Scenarios (1 undefined)
4 Steps (4 undefined)
0m0.021s
...
edit Based on the provided Eclipse project. The tests are supposed to be executed by TestNG. Therefor Cucumber runner must extend cucumber.api.testng.AbstractTestNGCucumberTests
assume following structure
/tmp/cuke/src/test/java/runnerPackage/RunnerTest.java
/tmp/cuke/features/myapplication.feature
/tmp/cuke/pom.xml
myapplication.feature
Feature: test
Scenario: login
Given open firefox
And start app
When enter details
Then login happens
RunnerTest.java
package runnerPackage;
import cucumber.api.CucumberOptions;
import cucumber.api.testng.AbstractTestNGCucumberTests;
@CucumberOptions(features = "features")
public class RunnerTest extends AbstractTestNGCucumberTests {
}
pom.xml
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0
http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>com.suboptimal</groupId>
<artifactId>cuke</artifactId>
<version>0.0.1-SNAPSHOT</version>
<packaging>jar</packaging>
<dependencies>
<dependency>
<groupId>io.cucumber</groupId>
<artifactId>cucumber-testng</artifactId>
<version>2.1.0</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>io.cucumber</groupId>
<artifactId>cucumber-java</artifactId>
<version>2.1.0</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.testng</groupId>
<artifactId>testng</artifactId>
<version>6.11</version>
<scope>test</scope>
</dependency>
</dependencies>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<maven.compiler.source>1.8</maven.compiler.source>
<maven.compiler.target>1.8</maven.compiler.target>
<surefire.version>2.18.1</surefire.version>
</properties>
</project>
run the test
cd /tmp/cuke
mvn test
results in
-------------------------------------------------------
T E S T S
-------------------------------------------------------
Running runnerPackage.RunnerTest
Configuring TestNG with:
org.apache.maven.surefire.testng.conf.TestNG652Configurator@6bf2d08e
1 Scenarios (1 undefined)
4 Steps (4 undefined)
0m0.018s
...
myapplication.feature
file.