Karthikeyan
Karthikeyan

Reputation: 2724

TestNG parallel attribute has no effect on the method execution

i am trying to run the test methods in parallel. The parallel attribute in the testNG xml has no effect on my execution. They runs same for all four possible options (methods,tests,classes,instances).i.e My methods are called in sequential for all the four option.but i need them to run in a parallel fashion. From here i understand the "methods" option should work for me. Any help?

The TestNG xml is as follows.

<!DOCTYPE suite SYSTEM "http://testng.org/testng-1.0.dtd" >
  <suite name="Test Suite" verbose="1" parallel="methods" thread-count="2">
     <test name="parallel">
        <classes>
          <class name="com.sample.A" />
        </classes>
     </test>
  </suite>

And the test class is as follow

package com.sample;

Class A
{

@Test
public void abc() throws Exception

{
        // some code here

}

@Test
public void xyz() throws Exception

{
        //some code here

}

 }

Upvotes: 2

Views: 1051

Answers (2)

Karthikeyan
Karthikeyan

Reputation: 2724

The same TestNG can now execute my methods in parallel. The issue was, though i have changed my xml the TestNG (in Eclipse)run configuration remained same. So i have changed to that to suite XML. Hence the changes made in the XML reflected in my test. Thanks everyone for your time.

Upvotes: 0

Ran Adler
Ran Adler

Reputation: 3707

you can see the link
http://maven.apache.org/surefire/maven-surefire-plugin/examples/junit.html


this is my pom 
           <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-surefire-plugin</artifactId>
                <version>2.9</version>
                <configuration>
                    <suiteXmlFiles>
                        <suiteXmlFile>${testng.xml}</suiteXmlFile>
                    </suiteXmlFiles>
                </configuration>
            </plugin>

Upvotes: 0

Related Questions