title: Using JUnit categories vs simply organizing tests in separate classes
body: <p>I have two logical categories of tests:  plain functional unit tests (pass/fail) and benchmark performance tests that are just for metrics/diagnostics.</p>
  
  <p>Currently, I have all test methods in a single class, call it <code>MyTests</code>:</p>
  
  <pre><code>public class MyTests 
  {
      @Test
      public void testUnit1()
      {
          ...
  
          assertTrue(someBool);
      }
  
      @Test
      public void testUnit2()
      {
          ...
  
          assertFalse(someBool);
      }
  
      @Test
      @Category(PerformanceTest.class)
      public void bmrkPerfTest1()
      {
          ...
      }
  
      @Test
      @Category(PerformanceTest.class)
      public void bmrkPerfTest2()
      {
          ...
      }
  }
  </code></pre>
  
  <p>Then I have a <code>UnitTestSuite</code> defined as</p>
  
  <pre><code>@RunWith(Categories.class)
  @Categories.ExcludeCategory(PerformanceTest.class)
  @SuiteClasses({ MyTests.class })
  public class UnitTestSuite {} 
  </code></pre>
  
  <p>and a <code>PerformanceTestSuite</code></p>
  
  <pre><code>@RunWith(Categories.class)
  @Categories.IncludeCategory(PerformanceTest.class)
  @SuiteClasses({ MyTests.class })
  public class PerformanceTestSuite {} 
  </code></pre>
  
  <p>so that I can run the unit tests in <code>Ant</code> separately from performance tests (I don't think including Ant code is necessary).</p>
  
  <p>This means I have a total of FOUR classes (MyTests, PerformanceTest, PerformanceTestSuite, and UnitTestSuite).  I realize I could have just put all the unit tests in one class and benchmark tests in another class and be done with it, without the additional complexity with categories and extra annotations.  I call tests by class name in Ant, i.e. don't run all tests in a package.</p>
  
  <p>Does it make sense and what are the reasons to keep it organized by category with the annotation or would it be better if I just refactored it in two simple test classes?</p>