【发布时间】:2019-12-19 20:46:27
【问题描述】:
我正在使用cucumber 和selenium 项目,我正在尝试通过Junit Test Runner 运行测试。这是the complete code(确保你的IDE中有lombok)。这是我的test runner:
@RunWith(Cucumber.class)
@CucumberOptions(
features = {"src/test/resources/features" },
monochrome = true,
plugin = {
"pretty",
"com.cucumber.listener.ExtentCucumberFormatter:target/report.html"
},
tags = {"@all"},
glue = {"stepDefinitions"}
)
public class TestRunnerJUnit {
@AfterClass
public static void setup() {
Reporter.setSystemInfo("User Name", System.getProperty("user.name"));
Reporter.setSystemInfo("Time Zone", System.getProperty("user.timezone"));
Reporter.setSystemInfo("Machine", "Windows 10" + "64 Bit");
Reporter.setTestRunnerOutput("Sample test runner output message");
}
}
关键是,当我使用测试运行器运行测试时,它会找到功能文件,但在其中找不到任何场景。这是运行的输出:
@all
Feature:
As a customer, I should be able to register for insurance.
0 Scenarios
0 Steps
0m0.000s
如果我直接使用功能文件运行测试(通过右键单击它Run as Cucumber 那么它运行良好。但是,我需要通过测试运行器运行我的测试)
【问题讨论】:
-
尝试从功能文件中删除第二个
@all
标签: java selenium junit cucumber test-runner