title: Running JUnit4 Test classes in specified order
body: <p>I've written a number of tests, divided not only into separate classes but, depending on what area of my application they're testing, into separate sub-packages. So, my package structure looks a bit like this:</p>
  
  <pre><code>my.package.tests
  my.package.tests.four
  my.package.tests.one
  my.package.tests.three
  my.package.tests.two
  </code></pre>
  
  <p>In the <code>my.package.tests</code> package I have a parent class that all tests in the sub-packages one through four extend. Now, I would like to choose the order in which the tests are run; not within the classes (which seems to be possible with the <a href="http://junit.czweb.org/apidocs/org/junit/FixMethodOrder.html" rel="noreferrer">FixMethodOrder annotation</a>) but the order of the classes or sub-packages themselves (So those in sub-package <code>one</code> first, then those in <code>two</code>, ect.). Some of the test classes use the <a href="http://junit.sourceforge.net/javadoc/org/junit/runners/Parameterized.html" rel="noreferrer">Parameterized runner</a>, just in case that makes a difference. Choosing the order is not required for the tests to succeed, they are independent of each other; it would however be helpful to sort them to reflect the order in which the various parts of the program are normally used as it makes the analysis a bit easier.</p>
  
  <p>Now, ideally I would like to have some configuration file which tells JUnit which order the tests should be executed in; I'm guessing however that it won't be so easy. Which options do I have here and what would be the easiest one? I'd also prefer to only have to list the sub-packages, not the various classes in the packages or even the test functions in the classes.</p>
  
  <p>I'm using Java 1.6.0_26 (I don't have a choice here) and JUnit 4.11.</p>