- Quick and easy generation of test cases and test data.
- Ability to reuse the older test cases as well as the test data for making a new test case.
- Generate test cases which stick on to their previous test values.
- Promote TDD, i.e. Test Driven Development
- Enhance productivity and reduce production cost.
- Excellent and highly comprehensive reporting technique.
- Easy contrast between expected output and the output displayed on the console.
- Logical aggregation of test cases.
- Add the JUnit.jar package in the class path environment variable of you system.
- Make a subclass of “TestCase”.
- In the subclass, define the actual test method you want to add. You may add multiple test methods.
- In the above methods write the assert methods.
- Test methods are declared public and have a void return type because they do not actually return a value after their execution.
- They have standard naming system with the name string pattern as “testXYZ”.
- XYZ in the naming pattern is the generic name for the target class on which the test is to be executed.
Test methods normally do not include any arguments.