JUnit is a Java framework for performing unit tests on code. By testing code
after every change, programmers can be reassured that changing a small amount of
code does not break the larger system.
Without automated testing tools like
JUnit, retesting can be a tedious and inaccurate process. By allowing the
testing process to occur frequently and automatically, you can keep software
coding errors at a minimum.
Creating the test cases, however, can be a difficult process requiring knowledge
of exactly what the code does and how it should perform. You must carefully
create the unit tests performed by JUnit to ensure that the tests rigorously
check the code just as it would run in the real world. In this article, we first
look at how to create unit tests and then at how to put together test suites.