I am facing an issue where I need to run script with three features. Let's say we have 3 feature files with tag names as @smoke1, @smoke2 and @smoke3. And I want these to be executed in that sequence.

Issue is that smoke3 is executing first and rest of them afterwards.

This is my script:

@Cucumber.Options(
    glue = { "com.abc", "cucumber.runtime.java.spring.hooks" },
    features = "classpath:",
    format = { "json", "json:target/cucumber.json" },
    tags = "@smoke1, @smoke2, @smoke3"
)
public class ex_Test extends AbstractTest { }
有帮助吗?

解决方案

Warning: This only works in older versions of Cucumber.

Cucumber feature files are executed in alphabetical order by path and filename. The execution order is not based on tags.

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

For example:

@Cucumber.Options(features={"first_smoke.feature", "another_smoke.feature"})

Should run first_smoke and then another_smoke (compared to the default which is to run in the other order.

其他提示

Ok we got it , We can have multiple tags for a single scenario like this @tag1 @tag2 @tag3.

You can not define the order in way below.

@Cucumber.Options(features={"first_smoke.feature", "another_smoke.feature"})

Cucumber determines the only alphabetical order and even only first letter of the word.

You can have how many tags you want in feature file, if you want to trigger feature file more times, it's not working like you will add tag more time or more tags from feature like:

tags = {"@Reports,@Reports"}

And tests are triggered in alphabetical order, it's checking tags not feature file name.

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top