我一直在玩Selenium Cucumber,发现了以下错误消息:
类型不匹配:无法从类StepDefinition转换为类扩展运行程序
这是我的密码:
package com.cucumber.JUnit;
import cucumber.api.CucumberOptions;
import cucumber.api.junit.Cucumber;
import org.junit.runner.RunWith;
import com.cucumber.steps.StepDefinition;
@RunWith(StepDefinition.class)
@CucumberOptions(
format = { "pretty", "html:report/test-report" },
features = { "src/test/resources/sample.feature" },
glue = { "com.cucumber.steps.StepDefinition" }
)
public class SampleCucumberJUnitRunner {
//Note: As with all Cucumber tests, the .feature file(s) will define what
will actually run.
}即使我正确导入了类,也无法理解错误的来源。我是不是遗漏了什么?
任何帮助都是值得感激的。提前谢谢!!
发布于 2018-01-07 07:13:31
将@RunWith(StepDefinition.class)更改为@RunWith(Cucumber.class)。
黄瓜运行程序需要使用扩展Runner.class的类运行;StepDefinition.class不扩展Runner.class。
https://sqa.stackexchange.com/questions/27085
复制相似问题