如何将多个功能文件添加到Cucumber Runner类 [英] How to add multiple feature files to Cucumber Runner Class

查看:55
本文介绍了如何将多个功能文件添加到Cucumber Runner类的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有3个独立的功能文件和一个 CucumberRunnerClass .按照需要执行的顺序,以下列出:

I have 3 separate feature files and one CucumberRunnerClass. As per the sequence need to execute those are listed below:

功能文件: Login.feature NavigateCusMngt.feature AddCustomer.feature

但是,执行时首先执行AddCustomer.feature,然后执行Login.feature,最后执行NavigateCusMngt.功能.

However, when executing it goes to first execute the AddCustomer.feature, then Login.feature and finally NavigateCusMngt.feature.

因此,我观察到 AddCustomer.feature -跳过,系统登录,然后 NavigateCusMngt.feature -提供了错误.

Therefore, I observed AddCustomer.feature - skipped, system logged in then NavigateCusMngt.feature -gives errors.

@CucumberOptions(
    features = {"src/test/resources/features/Login.feature", "src/test/resources/features/NavigateCusMngt.feature", "src/test/resources/features/AddCustomer.feature"},
    glue = {"phptravelstestcases"},
    tags = {"~@Ignore"},
    format = {
        "pretty",
        "html:target/cucumber-reports/cucumber-pretty/mercury-tours-RegisterUserTest",
        "json:target/cucumber-reports/json-reports/mercury-tours-RegisterUserTest.json",
        "rerun:target/cucumber-reports/rerun-reports/mercury-tours-RegisterUserTest.txt"
    }
)

请给我一个解决办法.

推荐答案

功能文件按字母顺序进行解析.我以正确的开头字母开头给我命名,例如

The feature files are parsed alphabetically. I named mine with a starting letter in the right order, e.g.

A-Login.feature
B-NavigateCusMngt.feature
C-AddCustomer.feature

从长远来看这并不理想,但这是一个可行的解决方案.

It's not ideal in the long run, but it is a workable solution.

这篇关于如何将多个功能文件添加到Cucumber Runner类的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆