Java 为什么JUnitTestRunner找不到这些特性?
我正在使用Java 为什么JUnitTestRunner找不到这些特性?,java,selenium,junit,cucumber,test-runner,Java,Selenium,Junit,Cucumber,Test Runner,我正在使用cucumber和selenium项目,我正在尝试使用Junit测试运行程序运行测试。这里是(确保您的IDE中有lombok)。这是我的测试跑步者: @RunWith(Cucumber.class) @CucumberOptions( features = {"src/test/resources/features" }, monochrome = true, plugin = {
cucumber
和selenium
项目,我正在尝试使用Junit测试运行程序运行测试。这里是(确保您的IDE中有lombok)。这是我的测试跑步者:
@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
如果我直接使用功能文件运行测试(通过右键单击它runascumber
,那么它工作得很好。但是,我需要通过testrunner运行我的测试)我有机会提取您的代码库并查看代码。
您遇到的问题与数据块库有关您在新行中提供了功能名称,而哪个数据块库无法理解这一点。在同一行中写下功能名称,它将解决您的问题
Feature: As a customer, I should be able to register for insurance.
我还建议您使用cucumber(cucumber JVM v4+)库的更新版本,该库具有并发执行支持(在单个JVM下)和当前库,您将使用该库根据您的配置跨越多个JVM实例尝试从功能文件中删除第二个@all