[英]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");
}
一直打印,直到“单击Seamless Switch”。 但是@Test注解方法(“打印”)中的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 core的run方法。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.