I tried to create JUnit Test Suite in eclipse by following the steps- Right click on the source folder -> New -> Other -> JUnit Test Suit. The issue is I am not getting the test classes under the comment ‘Test classes to include in suite'(no class is there) even though I have created Java application and corresponding JUnit test classes under the source folder.
In my source folder under default package –
Application name – test.java
JUnit test class – testTest.java and testTest1.java
As the JUnit test classes are not coming under the comment ‘Test classes to include in suite’, I am unable to create JUnit Test Suite.
Can anybody please help me to resolve this issue as I am new to JUnit?
Which versions of Eclipse and JUnit are you using? If you are new to JUnit I would recommend using version 4, which uses annotations to define test methods instead of having to subclass
TestCase. However, in versions of Eclipse up to 3.6 (Helios) the test suite wizard does not recognize JUnit 4 test cases.It looks like this has been fixed in version 3.7 (Indigo) although I have not tried it myself: https://bugs.eclipse.org/bugs/show_bug.cgi?id=155828
You can define a test suite by hand if you want to: Junit4 Test Suites
You might also find you can live quite happily without ever creating a test suite! To run all test cases in a package in Eclipse you can just right click the package and “Run as JUnit test”. For automated testing as part of a build I use Ant to run all test case classes with names matching a given pattern.