Wednesday, March 2, 2011

Adding JUnit Library to Eclipse Build Path

1. Download JUnit jar file

2. Open Eclipse IDE

3. Create a Java Project if you have not already created (Refer here)

4. Right click on the project and select "Properties"

5. In "Properties" window, select "Java Build Path" from right side tree

6. Click on "Libraries" tab

7. Click on "Add External Jars" button (See the below figure)
Figure: Build Path
8. Move to the location where junitx.jar file is located and add, click on "OK" button

9. A new node called "Referenced Libraries" must be created and JUnit jar file must be added into that as shown below
Figure: JUnit jar fiel ubder Referenced Libraries
Now, we can write JUnit test case.