How to add multiple feature files to Cucumber Runner Class [duplicate]

ⅰ亾dé卋堺 提交于 2021-01-29 09:25:13

问题


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

Feature files : Login.feature, NavigateCusMngt.feature, AddCustomer.feature

However, when executing it goes to first execute the AddCustomer.feature, then Login.feature and finally 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"
    }
)

please give me a solution.


回答1:


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.



来源:https://stackoverflow.com/questions/60035876/how-to-add-multiple-feature-files-to-cucumber-runner-class

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!