Hi,I have the following tests:public class TestA {@Testpublic void testA() {System.out.println("TestA Id: " + Thread.currentThread().getId());System.out.println("TestA Time: " + System.currentTimeMillis());for (int i = 0; i < 100; i++) {System.out.println("TestA Count: " + i);}System.out.println("TestA End Time: " + System.currentTimeMillis());}}public class TestB {
@Testpublic void testB() {System.out.println("TestB Id: " + Thread.currentThread().getId());System.out.println("TestB Time: " + System.currentTimeMillis());for (int i = 0; i < 100; i++) {System.out.println("TestB Count: " + i);}System.out.println("TestB End Time: " + System.currentTimeMillis());}}public class TestC {@Testpublic void testC() {System.out.println("TestC Id: " + Thread.currentThread().getId());System.out.println("TestC Start Time: " + System.currentTimeMillis());for (int i = 0; i < 100; i++) {System.out.println("TestC Count: " + i);}System.out.println("TestC End Time: " + System.currentTimeMillis());}}<?xml version="1.0" encoding="UTF-8"?><suite name="Test Suite" parallel="classes" thread-count="20"><test name="Tests" parallel="classes"><packages><package name="com.testng.test"/></packages></test></suite>When I run these tests with TestNg 6.2.1 with parallel=classes, it seems to run as expected => each test in a different thread and each thread running simultaneouslyWhereas with 6.5.2, each test runs in a different thread, but each thread seems to run one at a time, one after another.Please see attached test result files for more details.Thanks.--
You received this message because you are subscribed to the Google Groups "testng-users" group.
To view this discussion on the web visit https://groups.google.com/d/msg/testng-users/-/wsKvpf63pYgJ.
To post to this group, send email to testng...@googlegroups.com.
To unsubscribe from this group, send email to testng-users...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/testng-users?hl=en.
--Cédric
To unsubscribe from this group, send email to testng-users+unsubscribe@googlegroups.com.
Hi
Would it look different if you add a slight delay in the for loop?
/Alex
To view this discussion on the web visit https://groups.google.com/d/msg/testng-users/-/_eSawhhD-RwJ.
To post to this group, send email to testng...@googlegroups.com.
To unsubscribe from this group, send email to testng-users...@googlegroups.com.
Hi
Would it look different if you add a slight delay in the for loop?
/Alex
How about using Thread.yield() instead of Thread.sleep()?
To view this discussion on the web visit https://groups.google.com/d/msg/testng-users/-/XjNoJJP5K_QJ.
To post to this group, send email to testng...@googlegroups.com.
To unsubscribe from this group, send email to testng-users...@googlegroups.com.
How about using Thread.yield() instead of Thread.sleep()?
From: testng...@googlegroups.com [mailto:testng-users@googlegroups.com] On Behalf Of KT
I had tried to post this last night, but it doesn't seem to have gone through; otherwise, please forgive the double-post.I created a similarly simple project:ParallelTestClassA.javapublic class ParallelTestClassA {@BeforeClasspublic void setup() throws InterruptedException {System.out.println("" + System.currentTimeMillis() + " - testA setup starting (thread id = " + Thread.currentThread().getId() + ")");Thread.sleep(1000);System.out.println("" + System.currentTimeMillis() + " - testA setup finished (thread id = " + Thread.currentThread().getId() + ")");
}@Testpublic void testA() throws InterruptedException {
System.out.println("" + System.currentTimeMillis() + " - testA start (thread id = " + Thread.currentThread().getId() + ")");Thread.sleep(1000);System.out.println("" + System.currentTimeMillis() + " - testA finish (thread id = " + Thread.currentThread().getId() + ")");}@AfterClasspublic void tearDown() throws InterruptedException {System.out.println("" + System.currentTimeMillis() + " - testA tearDown starting (thread id = " + Thread.currentThread().getId() + ")");Thread.sleep(1000);System.out.println("" + System.currentTimeMillis() + " - testA tearDown finished (thread id = " + Thread.currentThread().getId() + ")");}}ParallelTestClassB.javapublic class ParallelTestClassB {@BeforeClasspublic void setup() throws InterruptedException {System.out.println("" + System.currentTimeMillis() + " - testB setup starting (thread id = " + Thread.currentThread().getId() + ")");Thread.sleep(1000);System.out.println("" + System.currentTimeMillis() + " - testB setup finished (thread id = " + Thread.currentThread().getId() + ")");}@Testpublic void testB() throws InterruptedException {System.out.println("" + System.currentTimeMillis() + " - testB start (thread id = " + Thread.currentThread().getId() + ")");Thread.sleep(1000);System.out.println("" + System.currentTimeMillis() + " - testB finish (thread id = " + Thread.currentThread().getId() + ")");}@AfterClasspublic void tearDown() throws InterruptedException {System.out.println("" + System.currentTimeMillis() + " - testB tearDown starting (thread id = " + Thread.currentThread().getId() + ")");Thread.sleep(1000);System.out.println("" + System.currentTimeMillis() + " - testB tearDown finished (thread id = " + Thread.currentThread().getId() + ")");}}testng.xml<suite name="Parallel Test Suite" parallel="methods" thread-count="20"><test name="Parallel Test"><classes><class name="parallel.ParallelTestClassA" /><class name="parallel.ParallelTestClassB" /></classes></test></suite>I set breakpoints in the @BeforeClass, @Test and @AfterClass methods in both classes.When I debugged through it with 6.5.2, the debugger stopped at ParallelTestClassA.setup(), and there was only one testing thread. A second thread didn't get created until after ParallelTestClassA.tearDown() finished.When I did the same thing with 6.2.1, when the debugger stopped at ParallelTestClassA.setup(), there were already 2 threads executing.This issue is important to my organization because we have a large suite of browser-driven tests, and we've seen the duration of our tests increase dramatically since upgrading to 6.5.2. So if there's any information I can provide that would help, please let me know!Thanks!
--
You received this message because you are subscribed to the Google Groups "testng-users" group.
To view this discussion on the web visit https://groups.google.com/d/msg/testng-users/-/-R-k2da7zVYJ.
To unsubscribe from this group, send email to testng-users...@googlegroups.com.
--Cédric
--Cédric
To unsubscribe from this group, send email to testng-users+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msg/testng-users/-/0OI3BbykC5EJ.
To unsubscribe from this group, send email to testng-users...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msg/testng-users/-/N3VVbYD1BcoJ.
To unsubscribe from this group, send email to testng-users...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msg/testng-users/-/7hPpW3pH1kUJ.
To unsubscribe from this group, send email to testng-users...@googlegroups.com.
Hi,
I am using Test NG 6.8.7 and am able to run tests in parallel using TestNG.
My problem is that the TestNG thread is still hanging around after the test execution is completed. It happens only when I set parallel on suite.
Please let me know how to get rid of hanging TestNG thread. I am doing the following:
Thanks,
Krishna