我有其余的测试前必须运行1测试的场景。其余的测试应该并行运行。如何使用Testng并行运行测试
例如:我在一个XML文件中有4个测试。一次测试应该在其他3次测试之前运行,3次测试应该平行运行。
是否有任何可能的方法使用TestNG framework来做到这一点。
谢谢 Raghuram。
我有其余的测试前必须运行1测试的场景。其余的测试应该并行运行。如何使用Testng并行运行测试
例如:我在一个XML文件中有4个测试。一次测试应该在其他3次测试之前运行,3次测试应该平行运行。
是否有任何可能的方法使用TestNG framework来做到这一点。
谢谢 Raghuram。
使用parallel="methods"
并且您的四种方法取决于您想要首先运行的方法(理想情况下使用组依赖关系)。
One test should run before the other 3 tests
标注该测试@BeforeTest
and the 3 tests should run parallel
。
与@Test注解运行它们,并在浴室的文件给并行=“方法”
<!DOCTYPE suite SYSTEM "http://testng.org/testng-1.0.dtd">
<suite thread-count="3" verbose="1" name="My Test Suite"
skipfailedinvocationcounts="false" junit="false" parallel="methods" preserve-order="true" data-provider-thread-count="10" annotations="JDK">
<test name = "my test" preserve-order="false">
<classes>
<class name ="com.mypackage.SampleClass"/>
<methods>method2</methods>
<methods>method3</methods>
<methods>method4</methods>
</classes>
</test>
谢谢塞德里克的回答。 – Raghuram