我的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>

当前,测试正在并行执行。但是我希望也可以并行执行这些类,如下所示:



请让我知道如何配置此设置。

最佳答案

现在明白了...

<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>

10-06 13:07