本文整理了Java中org.testng.TestNG.setThreadCount()
方法的一些代码示例,展示了TestNG.setThreadCount()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。TestNG.setThreadCount()
方法的具体详情如下:
包路径:org.testng.TestNG
类名称:TestNG
方法名:setThreadCount
[英]Define the number of threads in the thread pool.
[中]定义线程池中的线程数。
代码示例来源:origin: cbeust/testng
@Test
public void ensureThatParallelismAndThreadCountAreRallied() {
TestNG testng = create();
testng.setTestSuites(Collections.singletonList("src/test/resources/987.xml"));
testng.setThreadCount(2);
testng.setParallel(XmlSuite.ParallelMode.METHODS);
testng.run();
assertThat(Issue987TestSample.maps).hasSize(2);
assertThat(Issue987TestSample.maps.values()).contains("method2", "method1");
}
代码示例来源:origin: cbeust/testng
private void test(int threadCount) {
Helper.reset();
MultiThreadedDependentSampleTest.m_methods = Lists.newArrayList();
TestNG tng = create(MultiThreadedDependentSampleTest.class);
tng.setThreadCount(threadCount);
tng.setParallel(XmlSuite.ParallelMode.METHODS);
Map<Long, Long> map = Helper.getMap(MultiThreadedDependentSampleTest.class.getName());
synchronized(map) {
tng.run();
Assert.assertTrue(map.size() > 1, "Map size:" + map.size() + " expected more than 1");
assertOrder(MultiThreadedDependentSampleTest.m_methods);
}
}
}
代码示例来源:origin: cbeust/testng
@Test(invocationCount = 500)
public void testInvocationCounterIsCorrectForMethodWithDataProvider() {
final TestNG tng = create(FailedDPTest.class);
tng.setThreadCount(1);
tng.setParallel(XmlSuite.ParallelMode.NONE);
tng.setPreserveOrder(true);
final TestListenerAdapter tla = new TestListenerAdapter();
tng.addListener((ITestNGListener) tla);
tng.run();
ITestNGMethod method = tla.getTestContexts().get(0).getAllTestMethods()[0];
List<Integer> failed = method.getFailedInvocationNumbers();
assertEqualsNoOrder(failed.toArray(), FailedDPTest.primes.toArray());
}
}
代码示例来源:origin: org.testng/testng
setThreadCount(cla.threadCount);
代码示例来源:origin: cbeust/testng
@Test(dataProvider = "dp", description ="GITHUB-1029" )
public void ensureXmlTestIsNotNull(Class<?> clazz, XmlSuite.ParallelMode mode) {
XmlSuite xmlSuite = createXmlSuite("Suite");
createXmlTest(xmlSuite, "GITHUB-1029-Test", clazz);
xmlSuite.setParallel(mode);
Issue1029InvokedMethodListener listener = new Issue1029InvokedMethodListener();
TestNG testng = create(xmlSuite);
testng.addListener(listener);
testng.setThreadCount(10);
testng.setDataProviderThreadCount(10);
testng.run();
List<String> expected = Collections.nCopies(5, "GITHUB-1029-Test");
assertThat(listener.getBeforeInvocation()).containsExactlyElementsOf(expected);
assertThat(listener.getAfterInvocation()).containsExactlyElementsOf(expected);
}
代码示例来源:origin: cbeust/testng
setThreadCount(cla.threadCount);
代码示例来源:origin: cbeust/testng
tng.setPreserveOrder(false);
tng.setThreadCount(1);
内容来源于网络,如有侵权,请联系作者删除!