Introduction to Unit Testing with JUnit

Unit testing is a basic software testing activity that should be performed by every software developer. This handout produced by the Computer Science department of Stanford University introduces the ideas of unit testing and provides some examples on how to do it with JUnit in Eclipse.

The document starts by explaining some basic ideas behind unit testing, saying that they are a tool that provides a quick feedback about the quality of your code. It is also easier to change your code if you have some unit tests in place that can catch your mistakes. Unit tests are categorized in three categories: basic, advanced and edge. Each category is described in the article with examples. The last part of the article is dedicated on how to write unit tests for Java code in Eclipse using the JUnit framework.

Read the complete article on http://web.stanford.edu/class/cs108/handouts132/05UnitTesting.pdf