首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >黄瓜:类型错配不能在eclipse中从类<Step Definition>转换到Class<?extends Runner>

黄瓜:类型错配不能在eclipse中从类<Step Definition>转换到Class<?extends Runner>
EN

Stack Exchange QA用户
提问于 2017-05-04 17:01:26
回答 1查看 3.6K关注 0票数 2

我一直在玩Selenium Cucumber,发现了以下错误消息:

类型不匹配:无法从类StepDefinition转换为类扩展运行程序

这是我的密码:

代码语言:javascript
复制
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.
}

即使我正确导入了类,也无法理解错误的来源。我是不是遗漏了什么?

任何帮助都是值得感激的。提前谢谢!!

EN

回答 1

Stack Exchange QA用户

发布于 2018-01-07 07:13:31

@RunWith(StepDefinition.class)更改为@RunWith(Cucumber.class)

黄瓜运行程序需要使用扩展Runner.class的类运行;StepDefinition.class不扩展Runner.class。

票数 1
EN
页面原文内容由Stack Exchange QA提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://sqa.stackexchange.com/questions/27085

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档