我的testng.xml如下所示:
<suite name="Automation Suite" allow-return-values="true" verbose="1" parallel="tests" thread-count="2">
<test name="Login Test cases 01">
<parameter name="Operating_System" value="Windows 8"/>
<parameter name="Browser_Name" value="Internet Explorer"/>
<parameter name="Browser_Version" value="11"/>
<parameter name="Base_URL" value="https://www.google.com"/>
<classes>
<class name="com.automation.tool.Automation_01"/>
<class name="com.automation.tool.Automation_02"/>
</classes>
</test>
<test name="Login Test cases 02">
<parameter name="Operating_System" value="Windows XP"/>
<parameter name="Browser_Name" value="Mozilla Firefox"/>
<parameter name="Browser_Version" value="27"/>
<parameter name="Base_URL" value="https://www.google.com"/>
<classes>
<class name="com.automation.tool.Automation_01"/>
<class name="com.automation.tool.Automation_02"/>
</classes>
</test>
</suite>
目前,测试正在并行执行。但我希望并行执行这些类,如下所示:
线程01:测试01类01
线程02:测试01类02 线程03:测试02类01
线程04:测试02类02
请告诉我,如何配置此设置。
答案 0 :(得分:12)
现在搞定了......
<suite name="Automation Suite" allow-return-values="true" verbose="1" parallel="tests" thread-count="2">
<test name="Login Test cases 01" parallel="classes" thread-count="2">
<parameter name="Operating_System" value="Windows 8"/>
<parameter name="Browser_Name" value="Internet Explorer"/>
<parameter name="Browser_Version" value="11"/>
<parameter name="Base_URL" value="https://www.google.com"/>
<classes>
<class name="com.automation.tool.Automation_01"/>
<class name="com.automation.tool.Automation_02"/>
</classes>
</test>
<test name="Login Test cases 02" parallel="classes" thread-count="2">
<parameter name="Operating_System" value="Windows XP"/>
<parameter name="Browser_Name" value="Mozilla Firefox"/>
<parameter name="Browser_Version" value="27"/>
<parameter name="Base_URL" value="https://www.google.com"/>
<classes>
<class name="com.automation.tool.Automation_01"/>
<class name="com.automation.tool.Automation_02"/>
</classes>
</test>
</suite>
答案 1 :(得分:0)
在套件标签中更改&#34; parallel&#34;属性值来自&#34; tests&#34;到&#34;班级&#34;例如:
如果您想执行