java - TestNG 中的 setTestClasses 不适用于 setParallel?
问题描述
所以我想让我的 testNG 类并行运行。我还使用这样的工厂生成这些 testNG 类:
@Factory
public Object[] makeTests() {
Object[] tests = new Object[2];
for (int i = 0; i < 2; i++) {
tests[i] = new SampleTestClass(i);
}
return tests;
}
public static void main(String[] args) {
TestNG tng = new TestNG();
tng.setTestClasses(new Class[] {TestEngine.class});
tng.run();
}
我想并行运行这些测试类。但是当我尝试使用 tng.setParallel(XmlSuite.ParallelMode.CLASSES) 时,它不起作用。当我指定时,maven surefire 插件也没有:
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>2.22.0</version>
<configuration>
<parallel>classes</parallel>
<threadCount>10</threadCount>
</configuration>
</plugin>
</plugins>
</build>
这种设置测试类的方式是否有不同的并行化方式?
编辑:找到解决方案,它应该是 ParallelMode.INSTANCES。
解决方案
我对 Maven Surefire 也有类似的问题。唯一适用于并行执行的是:
<property>
<name>suitethreadpoolsize</name>
<value>16</value>
</property>
属性,maven-surefire 属性的一部分。
推荐阅读
- makefile - make: *** 没有规则来制作目标“watch_scss”。停止
- mongodb - 将当前日期应用于 MongoDB 聚合中的方程式
- jquery - 显示对话框时设置 AlertifyJS 回调
- odoo - 如何在odoo中的复选框中设置默认值
- xamarin.forms - Vimeo 未在 Xamarin.android 中显示全屏选项
- java - 带有微服务的春季云流
- android - 将 Player-ID 从 OneSignal 发送到 Webview Android Studio?
- arrays - 数组中具有时间相关常数的微分方程系统,使用 odeint
- mysql - 将关联数组中的数据保存到数据库
- php - 更新运行平衡