How to order feature files in Cucumber test suite?

我的梦境 提交于 2019-12-01 20:59:06
LudmilaN

In cucumber 4.2.0 added cli option --order, see changelog and this example.

Cucumber features/scenarios are run in Alphabetical order by feature file name.

However, if you specifically specify features, they should be run in the order as declared. For example:

@Cucumber.Options(features={"automatedTestingServices.feature", "smoketest.feature"})

You can force cucumber to run the feature files in the order that you pass the filenames as arguments. For example,

$ cucumber file3.feature file2.feature file1.feature

will run the files in the order file3.feature, file2.feature, file1.feature.

You could also create a text file with the names of the feature files in the order that you want, with each name on its own line. For example, suppose the file is named feature_order.txt and it has the following contents:

file3.feature
file2.feature
file1.feature

You can then run the following command to run the files in the above order:

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