title: How to group groovy tests?
body: <p>I have a few groovy test cases (i.e. classes that extend <code>GroovyTestCase</code> (version 1.8.2)). For example</p>
  
  <pre>
  class TestCaseA extends GroovyTestCase {void testA1() {...} void testA2() {...}}
  class TestCaseB extends GroovyTestCase {void testB1() {...} void testB2() {...}}
  </pre>
  
  <p>I would like to group the tests (test methods).<br>
  For example,</p>
  
  <pre>
  group X: TestCaseA.testA1, TestCaseB.testB1, TestCaseB.testB2,
  group Y: TestCaseB.testB2
  group Z: TestCaseA.testA1, TestCaseA.testA2 
  </pre>
  
  <p>In order to implement such grouping I would like to add <em>annotations</em>. (I can change the test sources).<br>
  For example:</p>
  
  <pre>
  class TestCaseA extends GroovyTestCase {
  
     @TestGroup (TestGroup.X, TestGroup.Z)   
     void testA1() {...}
  
     @TestGroup (TestGroup.Z)   
     void testA2() {...}
  }
  </pre>
  
  <p>Now I would like to write a <em>custom</em> <code>JUnit Runner</code>, which receives the "test groups" (e.g. as a command line argument or environment variable) and runs only the test methods annotated with these groups. </p>
  
  <p>Does it make sense? What are the alternatives? How to implement the <em>custom</em> JUnit Runner?  </p>