【问题标题】:How creating parallel work to TestNG + Maven (Suits)如何为 TestNG + Maven (Suits) 创建并行工作
【发布时间】:2014-06-11 03:46:38
【问题描述】:

老生常谈,我知道。然而,网络上的所有决定,在这个网站上 - 他们没有给出期望:这是执行多线程 套件的方法。 目前我找到了一种并行套件的方法:

public class MultipleXmls {
public static void main(String[] args) throws ParserConfigurationException, SAXException, IOException {
    TestNG testng = new TestNG();
    testng.setXmlSuites((List <XmlSuite>)(new Parser("C:\\Users\\S-Kerrigan\\WSI\\Java_ProjectsM_V.003\\Sets\\Suits\\TEST1.xml").parse()));
    testng.setSuiteThreadPoolSize(4);
    testng.run();
}
}

但它并没有被弃用——这种方法适用于 Java 应用程序。我需要从 Maven 以并行模式运行套装。

我尝试过使用 Grid-node 子系统,阅读 Maven 和 TestNG 上的扩展坞 - 没有什么能帮到我:(

【问题讨论】:

  • 您没有很好地阅读文档,请看这里:maven.apache.org/surefire/maven-surefire-plugin/examples/…(请参阅并行运行测试)。
  • 我读过这个文档 - 他们说如何创建并行“测试/方法/类”!这不是“套房”!如果我错了(如果我理解不正确),那么请给出一个工作代码。您将在其中运行多个并行套件。

标签: java multithreading maven testng


【解决方案1】:

你尝试过这样的事情吗?

                   <plugin>
                           <groupId>org.apache.maven.plugins</groupId>
                           <artifactId>maven-surefire-plugin</artifactId>
                           <version>9.9.9.9</version>

                           <configuration>>
                                   <parallel>methods</parallel>
                                   <threadCount>2</threadCount>
                                   <suitethreadpoolsize>2</suitethreadpoolsize>
                                   <suiteXmlFiles>
                                           <suiteXmlFile>testng-vm1.xml</suiteXmlFile>
                                           <suiteXmlFile>testng-vm2.xml</suiteXmlFile>>
                                   </suiteXmlFiles>
                           </configuration>

                   </plugin>

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2021-04-17
    • 1970-01-01
    • 2022-10-02
    • 1970-01-01
    • 2018-07-08
    • 1970-01-01
    • 1970-01-01
    • 2015-06-08
    相关资源
    最近更新 更多