JUnit 4 @BeforeClass & @AfterClass when using Suites
When using this approach below, by setting up the jUnit with Suites. We got the problem when all @BeforeClass in every Testclass will be executed before any tests starts to execute. (For each n TestClass file the @BeforeClass runs, then after they have execute, it started to execute the first MyTest.class files @Test) This will cause that we allocate up much resources and memory. My thoughts was that it must be wrong, shouldn't each @BeforeClass run only before the actual testclass is executed, not when the Suite is started? @RunWith(Suite.class) @Suite.SuiteClasses({ MyTests.class, Mytests2