问题
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