Composing Test Cases into Test Suites

Composing Test Cases into Test Suites


Posted in : Java Posted on : November 25, 2010 at 5:25 PM Comments : [ 0 ]

This section contains the detail about Composing Test Cases into Test Suites.

Composing Test Cases into Test Suites

  • If you have several tests you can combine them into a test suite. All tests 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 :

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 {
}

Output :

Run the Test suite by right click->Run as ->JUnite Test. The following window will appear :

Download Source Code

Go to Topic «PreviousHomeNext»

Your Comment:


Your Name (*) :
Your Email :
Subject (*):
Your Comment (*):
  Reload Image
 
 

 
Tutorial Topics