Note that there are some explanatory texts on larger screens.

plurals
  1. PORun TestNG tests in random order
    primarykey
    data
    text
    <p>Similarly to <a href="https://stackoverflow.com/questions/1444314/how-can-i-make-my-junit-tests-run-in-random-order">How can I make my JUnit tests run in random order?</a> , I'd like TestNG to run my tests in random order, so unintended dependencies cannot creep in.</p> <p>The <a href="http://testng.org/doc/documentation-main.html#parallel-running" rel="nofollow noreferrer">TestNG manual states</a>:</p> <blockquote> <p>By default, TestNG will run the tests found in your testng.xml file in a random order.</p> </blockquote> <p>However, I created a small test project, with a simple testng.xml:</p> <pre><code>&lt;?xml version="1.0" encoding="UTF-8"?&gt; &lt;!DOCTYPE suite SYSTEM "http://testng.org/testng-1.0.dtd" &gt; &lt;suite name="My suite"&gt; &lt;test name="Simple test"&gt; &lt;packages&gt; &lt;package name="testngtests"&gt;&lt;/package&gt; &lt;/packages&gt; &lt;/test&gt; &lt;/suite&gt; </code></pre> <p>The package <code>testngtests</code> contains two test classes (MyTest1, MyTest2), and these contain a few empty methods like this:</p> <pre><code>@Test public void testOne(){ } </code></pre> <p>The test mehods are all empty, and only differ by name.</p> <p>When I run them (using the Eclipse TestNG runner, or on the command line), the tests consistenly run in the same order (namely sorted alphabetically, first by class and then by method name).</p> <p>So is the documentation wrong?</p> <p>Or does "in random order" simply mean "there is no guaranteed order"? Then how can I make TestNG actively randomize test order?</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.
    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