Interview Questions

What Is JUnit TestSuite?

JUnit Questions and Answers

(Continued from previous question...)

What Is JUnit TestSuite?

JUnit TestSuite is a container class, junit.framework.TestSuite, used in JUnit 3.8 that allows you to group multiple test cases into a collection and run them together. TestSuite class is no longer supported in JUnit 4.4.

Each test runs in its own fixture so there can be no side effects among test runs. Here is an example:

import junit.framework.*;
// by
public class RunTestSuite {
    public static void main(String[] a) {
        TestSuite suite = new TestSuite(MathTest.class);
	TestResult result = new TestResult();;
        System.out.println("Was it successful? "
        System.out.println("How many tests were there? "

(Continued on next question...)

Other Interview Questions