Introduction
Junit is the unit testing tool for Java developers, and I'm often asked if Junit can be used inside of JBuilder. The answer, of course, is yes. Here are the simple steps required to include the Junit JAR file into your JBuilder environment.
A few simple steps
To use Junit inside of your JBuilder applications, all you need to do is add the Junit JAR file to the JBuilder environment as a standard library. Once that is set up, a few quick adjustments will get you up and running with Junit in just a few minutes.
Here are the steps to follow to get Junit integrated into your version of JBuilder:
1. Go to
www.junit.org and download the latest version (a zip file) of Junit.
2. Assuming that it's still distributed as a Zip file, unzip the zip file, and put the resulting Jar file in a place where you keep your other Jar files.
3. In JBuilder, go to Project|Default Project Properties, then add Junit as a Required Library.
4. When you finish that process it will be ready to use.
5. If you want to run the GUI tester, go to Project|Project Properties...|Run, and add this line to your VM Parameters:
junit.ui.TestRunner
6. At this point you can begin creating your Junit test classes.
7. When you are ready to run a TestCase, go to Project|Project Properties|Run, then select the "Main class". This is the class that contains your test case, assuming that you only have one test case.
That's really all there is to it. Of course using Junit well is an art in itself, but there are already excellent tutorials written on that subject, and using Junit inside of JBuilder is no different than using it anywhere else.
Enjoy!
Partager