如何 运行 黄瓜场景以及其他类型的测试?

How to run cucumber scenarios alongside other type of tests?

我有一些黄瓜方案 运行 宁顺利,但我也想 运行 其他类型的测试。比如,"test each component on the page" 不是一个有效的场景,因为 BDD 是用来检查行为的。 我想划分黄瓜场景和 selenium/components 测试

这是我的 运行ner:

@RunWith(Cucumber.class)
@CucumberOptions(
        monochrome = true,
        features = {"src/test/test/features/"},            
        glue = {"test.steps"},        
        tags = {""},        
        plugin = {"pretty", "com.aventstack.extentreports.cucumber.adapter.ExtentCucumberAdapter:" +
                "path"}
)

您的 Cucumber 测试将 运行 在构建期间与您的其他单元测试 (*Test) 或集成测试 (*IT) 同时进行,具体取决于 运行ner 的名称(您的代码片段中缺少它)。

根据您是使用 Cucumber 在单元测试级别还是集成测试级别断言行为,分别将您的 运行 命名为 RunCucumberTestRunCucumberIT

例如(使用您提供的选项):

@RunWith(Cucumber.class)
@CucumberOptions(
        monochrome = true,
        features = {"src/test/test/features/"},            
        glue = {"test.steps"},        
        tags = {""},        
        plugin = {"pretty", "com.aventstack.extentreports.cucumber.adapter.ExtentCucumberAdapter:" +
                "path"}
)
public class RunCucumberTest {
}