JUnit Question:
Download Job Interview Questions and Answers PDF
What Are JUnit 3.8 Naming Conventions?
Answer:
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.
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.
Download JUnit Interview Questions And Answers
PDF
Previous Question | Next Question |
How to Run Your JUnit 4.4 Tests with a JUnit 3.8 Runner? | How Many Test Runners Are Supported in JUnit 3.8? |