Junit 3.8 Download
-
Please look in your code...
What do you see???
-
Assert peers through the Monday cobwebs before your first pot of coffee. JUnit might be required for your job position. Ole Bruce Eckel's "Thinking in Java" (2002, free for the download, chap15) is what you want for a side-by-side comparision.
Eclipse is not a compiler, it is an Integrated Development Environment.
Eclipse has full support for JUnit out of the box, or you can download the latest JUnit jar and include it to your build path.
The purpose of Junit is to write code which test the logic in your code. The tests follow cases that are generally provided by your client so that when you make the program, you know it will do what the client wants it to do. It's also useful when updating. If someone updates your program and it fails the JUnit tests, then they did something wrong.
There are two ways to get JUnit imported to your project:
First way:
1) Download the latest jar from http://www.junit.org/
2) Right click the project, highlight "Build Path", select "Configure Build Path"
3) Go to the libraries tab and select "Add External Jar"
4) Add in the JUnit Jar
Second Way (May not be fully up to date, may not work depending on your eclipse):
1) Right click the project, highlight "Build Path", Select "Add Libraries"
2) Select JUnit
3) Press next and select version 4 and press OK
Proceed to write some tests (Use JUnit documentation for more information). After you have some tests written, a new run option will become available to you. Right click the project and say "Run As->JUnit Test". This will open up the JUnit perspective and run your tests, along with giving you information about whether they passed for failed.
It will not have any negative effect on eclipse.
I also recommend that you get a code coverage jar like cobertura. There happens to be a nifty plugin for eclipse called eCobertura that works excellently.
Cobertura will tell you how much of your code is executing as well as which code is the most popular.