黄瓜测试场景并行运行?
问题描述:
我在我的项目中有几个测试功能,到目前为止我使用线程数与runner类并行运行它们..但是这里的问题是优化执行时间,因为这些线程需要较长时间才能完成测试场景黄瓜测试场景并行运行?
有没有更好的方法来并行执行测试场景?
任何帮助..非常感谢!
答
看看小胡瓜,JVM
它增加功能,以并行的功能级别或在场景级别运行黄瓜测试。
它还提供了一个自动重新运行失败场景的选项。
用法
@RunWith(Courgette.class)
@CourgetteOptions(
threads = 10,
runLevel = CourgetteRunLevel.SCENARIO,
rerunFailedScenarios = true,
showTestOutput = true,
cucumberOptions = @CucumberOptions(
features = "src/test/resources/features",
glue = "steps",
tags = {"@regression"},
plugin = {
"pretty",
"json:target/courgette-report/courgette.json",
"html:target/courgette-report/courgette.html"}
))
public class RegressionTestSuite {
}
答
尝试使用QAF gherkin它并行运行方案而不是功能。您需要使用框架提供的工厂类,并使用testNG xml配置您的执行。下面是示例配置文件:
<test name="Gherkin-QAF-Test" parallel="methods">
<parameter name="step.provider.pkg" value="com.qmetry.qaf.automation.impl.step.qaf" />
<parameter name="scenario.file.loc" value="resources/features" />
<classes>
<class name="com.qmetry.qaf.automation.step.client.gherkin.GherkinScenarioFactory" />
</classes>
</test>
上述的配置将并行运行resources/features
下的特征文件可用的方案。
的可能的复制[如何执行黄瓜特征文件并行](http://stackoverflow.com/questions/41034116/how-to-execute-cucumber-feature-file-parallel) –
[Courgette-JVM](https://stackoverflow.com/questions/42513907/how-to-run-cucumber-jvm-test-scenarios-in-parallel-using-gradle)为我工作得很好 –