tags:

views:

1096

answers:

3
+5  Q: 

Junit4 Test Suites

How do I create test suites with Junit4? All the documentation I've seen doesn't seem to be working for me? And if I use the eclipse wizard it doesn't give me an option to select any of the test classes I created?

An up-to-date easy to digest documentation/tutorial link would be most welcome :)

Thanks,

Adam

+2  A: 

I think TestSuite has fallen out of favor. That might have been the style before 4.x, but it's not now as far as I know.

I just annotate the tests I want and then run the class. All the annotated tests are run. I might use Ant, but most of the time I have IntelliJ run them for me.

duffymo
A: 

Of the top of my head create a TestSuite and the invoke addTests. If you want somesource to look at try any opensource lib like hibernate or something from apache and take a look under the test directory of the source for a Tests suite ...

mP
+9  A: 
import org.junit.runners.Suite;

@RunWith(Suite.class)
@Suite.SuiteClasses({TestClass1.class, TestClass2.class})
public class TestSuite {
  //nothing
}
Joachim Sauer