简体   繁体   English

在并行计算机上依次运行testng测试

[英]Run testng tests successively on parallel machines

I have following configuration for webtesting with selenium: eclipse+maven+testng, selenium grid with 2 nodes. 我对硒进行网络测试有以下配置:eclipse + maven + testng,带有2个节点的硒网格。 1st node: ie10 + firefox; 第一个节点:ie10 + firefox; 2nd node: ie11+chrome. 第二个节点:ie11 + chrome。 I need to execute tests successively for node, but in parallel for nodes. 我需要依次对节点执行测试,但对节点并行执行测试。 Current configuration starts two methods for two nodes. 当前配置为两个节点启动两种方法。 Is it possible to reconfigure testng and maven to follow my needs? 是否可以根据我的需要重新配置testng和maven? I have no possibility to start 4 machine for each browser, only 2. Here is my testng xml 我无法为每个浏览器启动4台计算机,只有2台。这是我的testng xml

<suite name="Test Suite" thread-count="4" parallel="tests">
<test name="Tests - ie10">
    <parameter  name="browser" value="ie10"/>
    <classes>
        <class name="TestExportConfiguration"></class>
    </classes>      
</test>
<test name="Tests - chrome">
    <parameter name="browser" value="chrome"/>
    <classes>
        <class name="TestExportConfiguration"></class>
    </classes>      
</test>
<test name="Tests - firefox">
    <parameter name="browser" value="firefox"/>
    <classes>
        <class name="TestExportConfiguration"></class>
    </classes>      
</test>
<test name="Tests - ie11">
    <parameter name="browser" value="ie11"/>
    <classes>
        <class name="TestExportConfiguration"></class>
    </classes>      
</test>

and maven plugin configuration 和Maven插件配置

<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>2.16</version>
<configuration>
    <suiteXmlFiles>
        <suiteXmlFile>target/test-classes/testng.xml</suiteXmlFile>
    </suiteXmlFiles>
    <systemPropertyVariables>
        <browser>${browser}</browser>
    </systemPropertyVariables>
    <properties>
        <property>
            <name>usedefaultlisteners</name>
            <value>true</value>
        </property>
        <property>
            <name>listener</name>
            <value>org.uncommons.reportng.HTMLReporter, org.uncommons.reportng.JUnitXMLReporter</value>
        </property>
    </properties>
    <workingDirectory>target/</workingDirectory>
</configuration>

One option is to create 2 suite files - add that to 1 suite file. 一种选择是创建2个套件文件-将其添加到1个套件文件中。 In one suite file put 放在一个套件文件中

<suite name="Test Suite" thread-count="4" parallel="tests">
<test name="Tests - ie10">
    <parameter  name="browser" value="ie10"/>
    <classes>
        <class name="TestExportConfiguration"></class>
    </classes>      
</test>
<test name="Tests - chrome">
    <parameter name="browser" value="chrome"/>
    <classes>
        <class name="TestExportConfiguration"></class>
    </classes>      
</test>

In another put the other ones with firefox and ie11 with parallel=tests. 在另一个例子中,将其他人与firefox和ie11与parallel = tests放在一起。 Add both these suite files to one suite file. 将这两个套件文件都添加到一个套件文件中。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM