How To Group Test Cases Class using JUnit TestSuite?

Answer

Usually, there are many classes to be tested in a Java application. For each Java class in the application you need to write a JUnit test case class comtaining multiple test methods.

You could call a JUnit runner to run each JUnit test case class manually. But you should group all JUnit test case clases into a test suite with JUnit TestSuite. The following code and notes are provided by Varun Chopra and valid for JUnit 3.8 with some corrections.

To group all test case classes together and run them a single unit, you should create a new class named like AllTests.java. In this class you must create a "public static Test suite()" method, which returns a TestSuite object as a container of test case classes.

All unit-testing Questions

Ask your interview questions on unit-testing

Write Your comment or Questions if you want the answers on unit-testing from unit-testing Experts
Name* :
Email Id* :
Mob no* :
Question
Or
Comment* :
 





Disclimer: PCDS.CO.IN not responsible for any content, information, data or any feature of website. If you are using this website then its your own responsibility to understand the content of the website

--------- Tutorials ---