Note that there are some explanatory texts on larger screens.

plurals
  1. POIs testng running multithreaded?
    primarykey
    data
    text
    <p>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: <a href="http://maven.apache.org/surefire/maven-surefire-plugin/examples/testng.html" rel="nofollow">http://maven.apache.org/surefire/maven-surefire-plugin/examples/testng.html</a></p> <p><strong>edit: added surefire pom entry</strong></p> <pre><code>&lt;plugin&gt; &lt;groupId&gt;org.apache.maven.plugins&lt;/groupId&gt; &lt;artifactId&gt;maven-surefire-plugin&lt;/artifactId&gt; &lt;version&gt;2.12.4&lt;/version&gt; &lt;configuration&gt; &lt;suiteXmlFiles&gt; &lt;suiteXmlFile&gt;src/test/testng.xml&lt;/suiteXmlFile&gt; &lt;/suiteXmlFiles&gt; &lt;/configuration&gt; &lt;/plugin&gt; </code></pre> <p>I am using surefire 2.12.4.</p> <p>This is my testng.xml file</p> <pre><code>&lt;!DOCTYPE suite SYSTEM "http://testng.org/testng-1.0.dtd"&gt; &lt;suite name="Testng" parallel="methods" thread-count="3"&gt; &lt;test name="all" annotations="JDK5"&gt; &lt;packages&gt; &lt;package name="my.package.*"/&gt; &lt;/packages&gt; &lt;/test&gt; &lt;/suite&gt; </code></pre> <p>Inside several test methods I have a print statement:</p> <pre><code>System.out.println(Thread.currentThread().getName()); </code></pre> <p>That always has the same output every run (pool-1-thread-1). If testng was running parallel then there would be different threads running.</p> <p>My questions are: why is testng not running multithreaded? and is there a better way to check if testng is running multithreaded?</p> <p><strong>edit: classes or methods</strong></p> <p>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? </p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload