How to order feature files in Cucumber test suite?

2019-02-25 00:12发布

Currently, I have found that cucumber test suite runs the feature files alphabetically.

Please let me know if there is any option/configuration that I might be missing. Thanks.

3条回答
做个烂人
2楼-- · 2019-02-25 00:35

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"})
查看更多
对你真心纯属浪费
3楼-- · 2019-02-25 00:54

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)
查看更多
成全新的幸福
4楼-- · 2019-02-25 00:58

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

查看更多
登录 后发表回答