Automated Testing
- Advantages of automated testing:
- Less tedium
- Spot unintended consequences
- Important things to do:
- Every method gets at least one test case
- Ideally, there will be tests for every key aspect of its contract
- Every time a bug is found, a test case must be added that checks for it
- Using JUnit
- Download junit-4.5.jar
- Make eclipse aware of it by editing build path to add an external JAR
- Create a test class
- Test methods should be annotated with
@Test
- Run the test class
- Select "Run As JUnit Test" from the Eclipse green arrow
- Examples: