Brief description
In this lab, we first use junit to do the testing. Firstly, we should install the junit, hamcrest and eclemma.
1. Install junit
As for install junit, we need to download the junit.jar from the http://junit.org/junit4/. After that, we use the Eclipse IDE to create a java project, and we click the properties of the project. See figure1
Figure1
Then we choose the Java Build Path, and click the Add Library and select the JUnit, see figure2:
Figure2
If the above steps are done, we have done the installation for Junit.
2. Install hamcrest
The steps for hamcrest installation are the same as the junit installation. First, we should go to http://code.google.com/p/hamcrest/downloads/list to download hamcrest.zip. Next, we should right click the project and choose Build Path / Add External Archive, and select hamcrest-core-1.3.jar、hamcrest-library-1.3.jar. After doing those, you will see project properties like figure3:
Figure3
3. Install eclemma
Firstly, we need to open the Eclipse, click the Help menu and select the Install New Software, and click the Add.
Then we input the name Eclemma and input the location: http://update.eclemma.org/
Next, we choose the location which we inputted before.
All had been done after above steps.
Test Results
Coverage results: