title: Hierarchy of JUnit tests
body: <p>I need the following test</p>
  
  <pre><code>@runwith(cache, memory)
  class CollectionA is -- this is a suite (aka folder)
    class Cache {   -- this is a sub-suite (aka folder)
      @test testCache1()  -- this is a method (aka file)
      @test testCache2()
      @test testCache3()
    }
    class RAM {  -- this is a sub-suite (aka folder)
      @test testRAM1()
      @test testRAM2()
    }
    @test testIO()
    @test testKeyboard()
    @test testMouse()
    @test testMonitor()
    @test testPower()
    @test testBoot()
  </code></pre>
  
  <p>Please note that only Cache and RAM need to be grouped. The hierarchy helps to fight the complexity and run related tests, e.g. Cache subsystem, alone, when necessary. The problem that is as soon I use @runwith to do that grouping, all the single test methods besides the RAM and Cache collections are ignored by JUnit. It seems that you cannot have sibling files and folders in JUnit design. The comments in <a href="https://github.com/junit-team/junit/wiki/Aggregating-tests-in-suites" rel="nofollow">the official example of grouping</a> also hints that</p>
  
  <pre><code>@RunWith(Suite.class)
  @Suite.SuiteClasses({
    TestA.class,
    TestA.class
  })
  
  public class FeatureTestSuite {
    // the class remains empty,
    // used only as a holder for the above annotations
    // HEY!!! WHAT ABOUT MY @Tests HERE?
  }
  </code></pre>
  
  <p>The answers say that whether I need to wrap every single test, e.g. <code>testPower</code> into their singletone suit or flatten the suite - get rid if the hierarchy completely.</p>
  
  <p>So, is it right that JUnit is designed to disallow mixing single files (@test methods) with the folders (@runwith suites)? Why? How can this be worked around? Might be there is an alternative to <code>@runwith.Suite</code>?</p>