I have a java maven project that I want tested using multithreads. I have the testng.xml in src/test and the maven surefire plugin is configured to used it. Just like this page: http://maven.apache.org/surefire/maven-surefire-plugin/examples/testng.html
edit: added surefire pom entry
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>2.12.4</version>
<configuration>
<suiteXmlFiles>
<suiteXmlFile>src/test/testng.xml</suiteXmlFile>
</suiteXmlFiles>
</configuration>
</plugin>
I am using surefire 2.12.4.
This is my testng.xml file
<!DOCTYPE suite SYSTEM "http://testng.org/testng-1.0.dtd">
<suite name="Testng" parallel="methods" thread-count="3">
<test name="all" annotations="JDK5">
<packages>
<package name="my.package.*"/>
</packages>
</test>
</suite>
Inside several test methods I have a print statement:
System.out.println(Thread.currentThread().getName());
That always has the same output every run (pool-1-thread-1). If testng was running parallel then there would be different threads running.
My questions are: why is testng not running multithreaded? and is there a better way to check if testng is running multithreaded?
edit: classes or methods
When I run with threads each test class seems to run in it's own thread, but not each method. In the testng.xml I set parallel="methods" so it should do it per method. Can it not do per method?