Cucumber CLI 停止时没有任何错误

The Cucumber CLI stops without any error

我正在尝试找到一种将 JUNIT 测试方法与 Cucumber 集成以用于 JMeter 负载测试的方法。

我不知道为什么它没有执行完整的@Test 方法。为什么它毫无例外地停止。

下面是代码,

@Test
public void runTest() throws Throwable {

    try {
        String[] getRequest = GetRequest.testValuesReturn();
        Main.main(new String[]{"-g", "com.sanity.step.definition","-t", "@" +getRequest[1], "C:/Users/IBM_ADMIN/Documents/Automation/Performance Testing/PerformanceTesting/MyFeature.feature"});
        System.out.println("Print");
    } catch (Exception e) {
        e.printStackTrace();
    }
}    

测试一直运行到功能文件中定义的最后一步。下面是功能文件和最后一个方法。

When Start the performance Test
When Open the Inventory Page
When Click on Seamless Switch

最后一个方法,

 @When("^Click on Seamless Switch$")
public void Seamless_Switch() throws Throwable {    
    driver.baseDriver.findElement(By.id("seamlessSwitchButton")).click();
    log.info("Seamless switch is clicked");
    System.out.println("Click on Seamless Switch");
}

打印到 "Click on Seamless Switch"。但是@Test注解方法("Print")中的syso并没有打印在控制台中。

为什么无一例外地停止了?由于这个问题,在 JMeter 中,我什至在线程完成之前就收到以下错误,

 2017/06/01 13:40:31 INFO  - jmeter.reporters.ResultCollector: Shutdown hook started 
 2017/06/01 13:40:31 INFO  - jmeter.reporters.ResultCollector: Shutdown hook ended  

提前感谢您的回答!

Cucumber 核心 jar 中似乎有一个 System.exit(0)。

public static void main(String[] argv) throws Throwable {
        byte exitstatus = run(argv, Thread.currentThread().getContextClassLoader());
        System.exit(exitstatus);
    }

预计它应该关闭。我们可以改用 Cucumber 核心的 运行 方法。