File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes OO, Patterns, UML and Refactoring and the fly likes Sidebar >> OOCalculator >> Setting up JUnit Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Engineering » OO, Patterns, UML and Refactoring
Bookmark "Sidebar >> OOCalculator >> Setting up JUnit" Watch "Sidebar >> OOCalculator >> Setting up JUnit" New topic
Author

Sidebar >> OOCalculator >> Setting up JUnit

Junilu Lacar
Bartender

Joined: Feb 26, 2001
Posts: 4462
    
    6

Sidebar to this thread
Reply here to discuss any JUnit-related questions.
Dirk Schreckmann
Sheriff

Joined: Dec 10, 2001
Posts: 7023
Hello,
It looks like I'm going to have to stop hiding behind my IDE that takes care of path considerations for me all by itself.
What is the best or easiest setup to use with WinXP for setting up JUnit? Do I really want to add JUnit as a permanent path member in my system settings or what about just setting up a batch file to use with JUnit? What exactly would that batch file look like?
I thank you for your advice.
-Dirk Schreckmann


[How To Ask Good Questions] [JavaRanch FAQ Wiki] [JavaRanch Radio]
jason adam
Chicken Farmer ()
Ranch Hand

Joined: May 08, 2001
Posts: 1932
Hey Junilu, if you want, would glad to have an influx of JUnit questions come over to the IDE forum. Besides, might attract some other attention from people who don't normally read the OO forum. If you want, we can move this there.
Otherwise, I'll be following along with the rest of the crowd, this sounds like a very exciting project!
Junilu Lacar
Bartender

Joined: Feb 26, 2001
Posts: 4462
    
    6

Dirk,
I'm assuming your PATH variable is already properly set such that you can run java.
I prefer using the Swing version of TestRunner because then I can just keep JUnit up and keep editing and recompiling classes. Each time I hit the Run button in JUnit it uses the newly compiled versions of the classes. Same thing goes if you use a batch file.
If you want to use a batch file, this is the command you need:
java junit.swingui.TestRunner -cp .;($JUNIT)\junit.jar TestClass
where
($JUNIT) is the path to junit.jar and TestClass is the fully qualified name of the TestCase you want to run. You can substitute this with a command line parameter too if you want.
I'm using TextPad and setting it up is easy. I just add a new Tool Macro and configure it like so:
Command: ($JAVA)\bin\java.exe
Parameters: junit.swingui.TestRunner -cp .;d:\junit\junit.jar $Sel.$BaseName
Initial Folder: $FileDir
Where ($JAVA) would be the path to bin\java.exe. The $Sel macro parameter allows me to simply highlight the package name of the TestCase before running the Tool macro.
HTH,
Junilu
[ March 11, 2002: Message edited by: Junilu Lacar ]
Junilu Lacar
Bartender

Joined: Feb 26, 2001
Posts: 4462
    
    6

Jason,
Yes, I suppose the IDE forum is where this thread should really be. We'll need some help from Sandeep or a sheriff to move it there.
Junilu
Dirk Schreckmann
Sheriff

Joined: Dec 10, 2001
Posts: 7023
Hello,
Java plays no part in my system path settings, not as an Environment Variable nor as a path setting in autoexec.bat (it is not setup so that I can run java.exe from anywhere). My IDE takes care of it for me (I hate the command line - it brings back nightmares from the Days of Dos).
It's been a while since I've significantly used the command prompt (my therapist put me through an intensive withdrawal session soon after Win98SE came out) and I'd appreciate any advice on setting every detail up (especially advice about how to never have to use the command prompt).
In the mean time, I'll be stumbling around trying to figure it out and all of the newbies will miss out on my made up advice.
[ March 11, 2002: Message edited by: Dirk Schreckmann ]
Junilu Lacar
Bartender

Joined: Feb 26, 2001
Posts: 4462
    
    6

:roll: OK Dirk, the Command Prompt-Challenged Thread Hijacker, what's your IDE?
Dirk Schreckmann
Sheriff

Joined: Dec 10, 2001
Posts: 7023
It's JCreator. It's fast, small and lightweight.
Though I'm considering using JBuilder (for this project) because it is supposed to provide some sort of integration with JUnit. I'll have to look into it a bit more to see if any benefits derived from this integration outweigh the fantastically slow performance (on my machine) of the fantastically bloated JBuilder (which also has no support for the wheel on my mouse - What's up with that? Don't they know how lazy I am?).
Thank you for any advice.
jason adam
Chicken Farmer ()
Ranch Hand

Joined: May 08, 2001
Posts: 1932
I use JCreator LE, also. We can also set up user tools like Junilu described. Under configure->options->tools, you can do basically what she mentioned. That way you avoid the command-line, and get to use the environment you are used to.
Junilu Lacar
Bartender

Joined: Feb 26, 2001
Posts: 4462
    
    6

..she mentioned
And just to save ourselves some embarassment in the future, I'm a he.
Junilu
jason adam
Chicken Farmer ()
Ranch Hand

Joined: May 08, 2001
Posts: 1932
DOH!!!
Matt Horton
Ranch Hand

Joined: Feb 06, 2002
Posts: 107
lol, and you were about to get a billion proposals of marriage for being such a badarse.
Thanks, btw Junilu, this will be very fun.
Edward Valdemar
Greenhorn

Joined: Jun 12, 2003
Posts: 2
Hi all,
This thread didn't help me in getting JUnit installed.
I just put the junit.jar in the appropriate place and edited the classpath to point at it and away I went.


Thanks,<br />Edward
Dirk Schreckmann
Sheriff

Joined: Dec 10, 2001
Posts: 7023
Welcome to JavaRanch, Edward!
I'm glad you got JUnit working, and that you were able to resurrect an old thread from back when I didn't even know what the CLASSPATH was.
For future lurkers, Edwards suggestion of specifying the location of junit.jar in the system CLASSPATH setting is the the way to do it.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Sidebar >> OOCalculator >> Setting up JUnit