Interview Questions

What Are JUnit 3.8 Naming Conventions?

JUnit Questions and Answers


(Continued from previous question...)

What Are JUnit 3.8 Naming Conventions?

JUnit 3.8 suggests the following naming conventions:

Test Case Class: Named as [classname]Test.java, where "classname" is the name of the class that is being tested. A test case class define the fixture to run multiple tests. A test case class must be subclass of junit.framework.TestCase.

Test Method: Named test[XXX], where "XXX" is any unique name for this test. A test method name should be prefixed with "test" to allow the TestSuite class to extract it automatically. A test method must be declared as "public".

Test Suite: Can be named any way you want to. But Eclipse uses AllTests.java as the name. A test suite is a collection of test cases.

(Continued on next question...)

Other Interview Questions