如何使用 @tags 在 Cucumber 框架中运行 testrunner 类文件中的多个标签?

tsi*_*jan 0 java selenium cucumber-junit selenium-webdriver cucumber-java

@RunWith(Cucumber.class)
@CucumberOptions( plugin = {"pretty","html:target/html/automation"},
                features = {"resource/***.feature"},
                glue={},
                tags={"@login","@Products"}
        )
Run Code Online (Sandbox Code Playgroud)

这是我的功能文件

@登录

功能:登录应用程序

场景:这是验证应用程序是否已成功登录给定导航到 Panasonic 应用程序然后验证应用程序的标题然后注销应用程序

@产品

功能:登录应用程序

背景:用户应该导航到应用程序的主页

给定用户使用有效凭据登录主页

单击主页上的目录链接时

场景:验证产品页面是否可以创建十个以上产品

并检查目录的子菜单是否显示在标题中

并检查我的产品目录表

小智 6

对于多个标签 Cucumber 使用逻辑 AND 和逻辑 OR。例如,下面的内容对我来说效果很好。

@RunWith(Cucumber.class)
@CucumberOptions(plugin = {"pretty", "html:target/cucumber-report.html"},
        features= "Features",
        glue= {"com.cucumber.stepdefinition"},
        tags= "@RegressionTest or @SmokeTest"
        )
public class TestRunner {
}

Run Code Online (Sandbox Code Playgroud)