为什么 Junit TestRunner 找不到功能?

Why Junit TestRunner cannot find the features?

我正在与 cucumberselenium 项目合作,我正在尝试 运行 通过 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");
    }

}

重点是,当我 运行 使用测试 运行ner 进行测试时,它找到了功能文件,但没有在其中找到任何场景。这是 运行:

的输出
@all
Feature: 
  As a customer, I should be able to register for insurance.

0 Scenarios
0 Steps
0m0.000s

如果我 运行 直接使用功能文件进行测试(通过右键单击它 Run as Cucumber 那么它工作正常。但是,我需要 运行 我的测试 [= =25=]内)

我有机会提取您的代码库并查看代码。 您 运行 遇到的问题与扩展库有关。 您在新行中提供要素名称,哪个 extent 库无法理解。在同一行写上功能名称应该可以解决你的问题

Feature: As a customer, I should be able to register for insurance.

我还建议您使用更新版本的 Cucumber (Cucumber-JVM v4+) 库,这些库具有并发执行支持(在单个 JVM 下)和您正在使用的当前库将根据您的配置跨越多个 JVM 实例