This section contains the detail about how to Create a test suite
Create a Test Suite
-
If you have several tests you can combine them into a test suite. All test in this test suite will then be executed if you run the test suite.
-
To create a new test suite, select your package, right mouse click->, select New->Others->JUnit Test Suite->next->Finish.
-
We have three classes, which we want to test within test suite
CounterTest
MyClassTest
PetTest
Given below the code of Test suite class "AllTests.java" :
package devmanuals.junit; import org.junit.runner.RunWith; import org.junit.runners.Suite.SuiteClasses; import org.junit.runners.Suite; @RunWith(Suite.class) @SuiteClasses( { CounterTest.class, MyClassTest.class, PetTest.class }) public class AllTests { }
Run the Test suite by right click->Run as ->JUnit Test. The following window will appear :
[ 0 ] Comments