testng icon indicating copy to clipboard operation
testng copied to clipboard

Parallel classes seems to be ignored when using groups.

Open sergejjkim opened this issue 10 years ago • 3 comments

So i have two tests classes and pom.xml

<plugin>
    <groupId>org.apache.maven.plugins</groupId>
    <artifactId>maven-surefire-plugin</artifactId>
    <version>2.19.1</version>
    <configuration>
        <parallel>classes</parallel>
        <threadCount>30</threadCount>
        <perCoreThreadCount>false</perCoreThreadCount>
        <excludes>
            <exclude>${exclude.tests}</exclude>
        </excludes>
    </configuration>
</plugin>

which i run with mvn clean test -Dgroups=smoke

and i get 5 threads with 4 test methods from 1st class and 1 test method from 2nd class launched concurrently, however i expect 2 test methods from different classes to be ran concurrently.

If i don't specify -Dgroups=smoke, everything is fine and acts as expected: 2 test methods from different classes are launched.

Alternatively I have a suite

<suite name="My suite" parallel="classes" thread-count="30">
    <test name="test1">
        <groups>
            <run>
                <include name="smoke"/>
            </run>
        </groups>
        <classes>
            <class name="com.spredfast.qa.mobileauto.ios.tests.publishing.general.TestPublishMessageIOS"/>
            <class name="com.spredfast.qa.mobileauto.ios.tests.TestLoginIOS"/>
        </classes>
    </test>
</suite>

and running this suite also results in 5 threads with 4 test methods from 1st class and 1 test method from 2nd class launched. Expected result is the same: 2 test methods from different classes to be ran concurrently.

When I alter the suite as following:

<suite name="My suite" parallel="tests" thread-count="30">
    <test name="test1">
        <groups>
            <run>
                <include name="smoke"/>
            </run>
        </groups>
        <classes>
            <class name="com.spredfast.qa.mobileauto.ios.tests.TestLoginIOS"/>
        </classes>
    </test>
    <test name="test2">
        <groups>
            <run>
                <include name="smoke"/>
            </run>
        </groups>
        <classes>
            <class name="com.spredfast.qa.mobileauto.ios.tests.publishing.general.TestPublishMessageIOS"/>
        </classes>
    </test>
</suite>

the 2 test methods from different classes get launched and only test methods from the smoke group get executed.

sergejjkim avatar Feb 28 '16 14:02 sergejjkim

Ok, thank, I understand now.

juherr avatar Feb 29 '16 16:02 juherr

Any updates on this issue ? I am facing the exact issue. My SuiteXml File is something like this.

current stable testNg version I am using 6.14.3 and also tried on 6.9.10

Current Behaviour: Getting few classes executed Rest other classes gets skipped with NullPointerException

ag22494 avatar Jan 07 '20 17:01 ag22494

@ag22494 - Do you have a sample that can be used to reproduce your problem ? Latest released version of TestNG is 7.1.0

krmahadevan avatar Jan 28 '20 03:01 krmahadevan