首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >黄瓜Runner类不运行步骤定义

黄瓜Runner类不运行步骤定义
EN

Stack Overflow用户
提问于 2018-06-06 15:09:44
回答 1查看 7.1K关注 0票数 2

我正在用Cucumber和Java编写自动化测试。

我可以通过右键单击我的特性文件来运行步骤定义,并将其作为Cucumber特性运行,所有步骤都会成功通过。

但是,我需要使用Runner类来运行它们。

我的功能文件在这个文件夹中:

src/test/java/特性

我的步骤定义在这个文件夹中:

src\test\java\com\abc\commercial\def\automation

我的Runner类也存储在

src\test\java\com\abc\commercial\def\automation

下面是Runner类代码:

代码语言:javascript
复制
@RunWith(Cucumber.class)
@CucumberOptions(
    plugin = {"progress",
            "html:build/report/html",
            "junit:build/report/junit/cucumber-report.xml",
            "json:build/report/json/cucumber-report.json"
    },
    glue = {"src\\test\\java\\com\\abc\\commercial\\def\\automation"},
    features = {"src/test/java/features"}
    )
public class QARunner {

public static void main(String[] args) {
    // TODO Auto-generated method stub

    }
}

当我以JUnit测试的形式运行Runner时,我在控制台中收到以下响应:

代码语言:javascript
复制
UUUUUUUUU

Undefined scenarios:
src/test/java/features/US46052
src/test/java/features/postFeatures.feature:43 # As the

2 Scenarios (2 undefined)
9 Steps (9 undefined)
0m0.303s


You can implement missing steps with the snippets below:

@Given("the Application...")
public void the_Application...() {

因此,步骤定义没有被提取。

这与我的测试跑步者所处的位置有关吗?我不认为它是在自动文件夹中提取步骤定义

谢谢你的帮助

EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2018-06-06 15:30:19

试试这个:不需要主要的方法。glue选项应该是包样式的。

代码语言:javascript
复制
@RunWith(Cucumber.class)
@CucumberOptions(
    plugin = {"progress",
            "html:build/report/html",
            "junit:build/report/junit/cucumber-report.xml",
            "json:build/report/json/cucumber-report.json"
    },
    glue = {"com.abc.commercial.def.automation"},
    features = {"src/test/java/features"}
    )
public class QARunner {

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

https://stackoverflow.com/questions/50723798

复制
相关文章

相似问题

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