testng icon indicating copy to clipboard operation
testng copied to clipboard

Parallel test run is not working in 6.13.1

Open ghost opened this issue 9 years ago • 4 comments

Example test class

public class ThreadCountTest {

    @Test
    public void test1(){
        System.out.println(Thread.currentThread().getId());
    }

    @Test
    public void test2(){
        System.out.println(Thread.currentThread().getId());
    }

    @Test
    public void test3(){
        System.out.println(Thread.currentThread().getId());
    }
}
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE suite SYSTEM "http://testng.org/testng-1.0.dtd">
<suite name="Thread count" parallel="methods" thread-count="3">
    <test name="Test">
        <classes>
            <class name="onetech.ThreadCountTest"/>
        </classes>
    </test>
</suite>

TestNG - 6.11 output

13
14
15

(Each test is launched in a separate thread which is indicated by unique thread id)

TestNG - 6.13.1 output

1
1
1

(Every test is launched in the same thread)

Is the issue reproductible on runner?

  • [ ] Shell
  • [x] Maven
  • [ ] Gradle
  • [ ] Ant
  • [ ] Eclipse
  • [x] IntelliJ
  • [ ] NetBeans

Test case sample

See above

ghost avatar Dec 04 '17 14:12 ghost

@da-yaroslav-orel - Thanks for submitting this issue. We will look into it.

In the meantime, if you were to use a suite xml file such as the one below, you should see your tests run in parallel.

<suite name="Thread count" parallel="methods" thread-count="3" verbose="3">
    <test name="Test" parallel="methods" thread-count="3">
        <classes>
            <class name="foo.ThreadCountTest"/>
        </classes>
    </test>
</suite>

Note That I have merely added the parallel and the thread-count attributes at the <test> level as well.

krmahadevan avatar Dec 05 '17 03:12 krmahadevan

This seems to have gotten introduced only with TestNG 6.13.1. Until 6.12 we are good.

krmahadevan avatar Dec 05 '17 03:12 krmahadevan

The parallel run does not work on 6.14.2

tsheva avatar Aug 20 '18 17:08 tsheva

@tsheva

The latest released version of TestNG is 6.14.3. So please do the following:

  1. Try reproducing your issue using TestNG 6.14.3.
  2. If (1) fails, please also try using TestNG 7.0.0-SNAPSHOT [ This is the upcoming version that will get eventually released ]
  3. If (2) also fails, please file a new bug, with a sample (standalone with no external library references) that can be used to reproduce the problem.

krmahadevan avatar Aug 21 '18 04:08 krmahadevan