I have a problem when try to run my code, since the runner created! When running it, it shows me the message:
java: cannot access cucumber.runtime.model.CucumberFeature class file for cucumber.runtime.model.CucumberFeature not found
My feature:
Feature: LoginFeature
This feature is responsible for testing all the scenarios for Login application
Scenario: Create a new Login with correct username and password
Given I ensure application opened
When I enter Username and Password
|UserName |Password |
|TEST |TEST |
Then I click login button
Then I should see the Campaign page displayed
My Runner file:
package com.crm.test.runner;
import cucumber.api.testng.CucumberFeatureWrapper;
import cucumber.api.testng.TestNGCucumberRunner;
import io.cucumber.junit.CucumberOptions;
import org.testng.annotations.AfterClass;
import org.testng.annotations.BeforeClass;
import org.testng.annotations.DataProvider;
import org.testng.annotations.Test;
@CucumberOptions(features = {"src/test/com/crm/test/features"}, glue =
{"src/test/com/crm/test/steps"})
public class TestRunner {
private TestNGCucumberRunner testNGCucumberRunner;
@BeforeClass(alwaysRun = true)
public void setUpClass(){
testNGCucumberRunner = new TestNGCucumberRunner(this.getClass());
}
@Test(dataProvider = "features")
public void runTest(CucumberFeatureWrapper cucumberFeatureWrapper){
testNGCucumberRunner.runCucumber(cucumberFeatureWrapper.getCucumberFeature());
}
@DataProvider
public Object[][] features(){
return testNGCucumberRunner.provideFeatures();
}
@AfterClass(alwaysRun = true)
public void afterClass(){
testNGCucumberRunner.finish();
}
}
Error Log
/Users/diegohidalgo/IdeaProjects/CRMFramework/src/test/com/crm/test/runner/TestRunner.java:24:83
java: cannot access cucumber.runtime.model.CucumberFeature
class file for cucumber.runtime.model.CucumberFeature not found
You are using 'import io.cucumber.junit.CucumberOptions;' Junit options in TestNG-Cucumber
Change the import to 'import io.cucumber.testng.CucumberOptions;