aspose file tools*
The moose likes IDEs, Version Control and other tools and the fly likes eclipse and and junit Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Engineering » IDEs, Version Control and other tools
Bookmark "eclipse and and junit" Watch "eclipse and and junit" New topic
Author

eclipse and and junit

billo bailey
Ranch Hand

Joined: Dec 02, 2002
Posts: 50
Hi all,
I've been googling for ages and am still stuck, so maybe someone here could help me out. For anyone who uses ANT, Junit and eclipse together I guess you know what my problem is and can help me. I just can't get these three technologies to play nice. I have followed this sites tutorial down to a tee http://dsd.lbl.gov/~ksb/Scratch/jajucc_hw.html and got to the stage where junit is introduced, I've tried adding junit.jar to ant/lib and the alternate method also but still no joy. Here's the output I get:


I need to use these for a college project. Also I have restricted permissions on the college machines and won't be able to delete or add to eclipse directories. Can anyone help me. Thanks.
bill


only users lose drugs
miguel lisboa
Ranch Hand

Joined: Feb 08, 2004
Posts: 1281
this line

states java cant find TestHello class
does TestHello lies inside a package named hello?


java amateur
billo bailey
Ranch Hand

Joined: Dec 02, 2002
Posts: 50
TestHello is in the hello package.
Craig Jackson
Ranch Hand

Joined: Mar 19, 2002
Posts: 405
TestHello is in the hello package.


Then the "hello" package is not found in the CLASSPATH.
billo bailey
Ranch Hand

Joined: Dec 02, 2002
Posts: 50
I don't think that is the problem, I think its an issue with ANT run from eclipse ( in fact I know it is) I was hoping someone could tell me how to workaround it. As the workarounds I've seen haven't worked for me. I'm using eclipse3.2 and ANT1.6.1.
Tim Holloway
Saloon Keeper

Joined: Jun 25, 2001
Posts: 16012
    
  19

There's no benefit in modifying Eclipse's directories when you're running tests from Ant. Just pretend that Eclipse doesn't even exist. That gives you one less thing to worry about.

It's common practice when setting up a test project to have a separate source and output class tree from the actual application code. I even go so far as to set things up where I can physically rip out the test subsystem from the directory tree and/or Ant script and the app code won't care, but I can be extreme sometimes.

So in a case like this, the Junit test needs to find:

1. The Junit Ant task (in Ant's extras jar)
2. Junit.jar itself
3. The app's classes
4. The test classes.

Actually, Ant needs to find the Junit Ant task. It doesn't need to be locateable by the Junit test itself. There's really 2 different classpaths, one used by Ant and the other by the Ant task (junit).


Customer surveys are for companies who didn't pay proper attention to begin with.
billo bailey
Ranch Hand

Joined: Dec 02, 2002
Posts: 50
Thanks for the help, finally its working.
Ken Loh
Ranch Hand

Joined: Feb 16, 2005
Posts: 190
Care to share with the rest of us of how you got it to work ?

Originally posted by billo bailey:
Thanks for the help, finally its working.
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
 
subject: eclipse and and junit