unit test support for java via reflection and annotations
Novice Java programmers face great difficulties when learning to design unit tests for any nontrivial cases. Deciding whether the result of a method, or the effect the method produced represents the expected result one must understand the difference between equality based on the values an object represents versus the reference equality (identity) --- and be able to define the correct equals method. We describe the tester library that supports test design, evaluation, and reporting of the results in the manner that supports a novice programmer. The library uses Java reflection and annotation to compare any two data items (primitive types or objects) by the value they represent, produces report where the expected and actual values are pretty-printed, and a failed test report includes a link to the failed test. The library has been used in classrooms and is used daily in our program design.
testing design cs1/2