I know you can specify tags for features and then ignore them when running cucumber on the command line. But I'm using cucumber-jvm and running it from maven. @ignore doesn't work and I wouldn't know how to pass the to-be-ignored tags to the runner that executes the Gherkin tests.

The work-around is to move feature that are done to another directory while developing and testing new ones, but that's not how it should be. How do other users deal with this deficiency?

有帮助吗?

解决方案 2

You can tag your scenarios as @ignore which will be ignored.

If you want to run only selective scenarios then mark your every new feature that you want to test as @new_test. Tell the Cukes Runner to run only tags = @new_test

import org.junit.runner.RunWith;
import cucumber.api.junit.Cucumber;

@RunWith(Cucumber.class)
@Cucumber.Options(features = {"classpath:my_feature.feature"},
tags = {"@new_test"})
public class RunCukesTest {

}

Anything that you don't want to test should not have a tag or should have some other tag name

其他提示

You can tell runner skip @ignore

import org.junit.runner.RunWith;
import cucumber.api.junit.Cucumber;

@RunWith(Cucumber.class)
@Cucumber.Options(features = {"classpath:my_feature.feature"},
tags = {"~@ignore"})
public class RunCukesTest {
}
许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top