无法访问 cucumber.runtime.model.CucumberFeature - Selenium 测试
cannot access cucumber.runtime.model.CucumberFeature - Selenium Test
我在尝试 运行 我的代码时遇到问题,因为 运行ner 创建了!
当 运行 连接它时,它向我显示消息:
java: 无法访问 cucumber.runtime.model.CucumberFeature
class 找不到 cucumber.runtime.model.CucumberFeature 的文件
我的特点:
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
我的 Runner 文件:
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();
}
}
错误日志
/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
您正在使用 'import io.cucumber.junit.CucumberOptions;' TestNG-Cucumber 中的 Junit 选项
将导入更改为'导入io.cucumber.testng.CucumberOptions;
我在尝试 运行 我的代码时遇到问题,因为 运行ner 创建了! 当 运行 连接它时,它向我显示消息:
java: 无法访问 cucumber.runtime.model.CucumberFeature class 找不到 cucumber.runtime.model.CucumberFeature 的文件
我的特点:
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
我的 Runner 文件:
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();
}
}
错误日志
/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
您正在使用 'import io.cucumber.junit.CucumberOptions;' TestNG-Cucumber 中的 Junit 选项
将导入更改为'导入io.cucumber.testng.CucumberOptions;