Skip to search.

Breaking News Visit Yahoo! News for the latest.

×Close this window

junit · JUnit, the Java unit testing framework written by Kent Beck and Erich Gamma.

The Yahoo! Groups Product Blog

Check it out!

Group Information

  • Members: 31224
  • Category: Java
  • Founded: Nov 6, 2000
  • Language: English
? Already a member? Sign in to Yahoo!

Yahoo! Groups Tips

Did you know...
Message search is now enhanced, find messages faster. Take it for a spin.

Messages

Advanced
Messages Help
Messages 214 - 243 of 24387   Oldest  |  < Older  |  Newer >  |  Newest
Messages: Show Message Summaries Sort by Date ^  
#214 From: csampietro@...
Date: Tue Jan 9, 2001 4:14 pm
Subject: JUNIT3.4 and JDK1.1.x support
csampietro@...
Send Email Send Email
 
Hi all eGroups members,

is it possible to use JUnit 3.4 with JDK 1.1.* ?

If I run it with JDK 1.1.8, I get the following error output:

D:\junit3.4>e:\jdk1.1.8\bin\java -classpath
e:\jdk1.1.8\lib\classes.zip;.\junit.
jar;. junit.textui.TestRunner junit.samples.AllTests
java.lang.NoSuchMethodError: java.util.Properties: method
setProperty(Ljava/lang
/String;Ljava/lang/String;)Ljava/lang/Object; not found
         at junit.runner.BaseTestRunner.<init>(BaseTestRunner.java:157)
         at junit.textui.TestRunner.<init>(TestRunner.java:35)
         at junit.textui.TestRunner.main(TestRunner.java:87)

while using JDK1.2.2 (or JDK1.3) everything works well.

Is there any compatibility jar (or other tips) to support JDK 1.1.* ?
Thanks for the attention
Regards
Carlo

#215 From: Benjamin Schroeder <schroeder@...>
Date: Tue Jan 9, 2001 5:04 pm
Subject: Re: JUNIT3.4 and JDK1.1.x support
schroeder@...
Send Email Send Email
 
on 1/9/01 11:14 AM, csampietro@... at csampietro@...
wrote:

> Hi all eGroups members,
>
> is it possible to use JUnit 3.4 with JDK 1.1.* ?
>
> If I run it with JDK 1.1.8, I get the following error output:
>
> D:\junit3.4>e:\jdk1.1.8\bin\java -classpath
> e:\jdk1.1.8\lib\classes.zip;.\junit.
> jar;. junit.textui.TestRunner junit.samples.AllTests
> java.lang.NoSuchMethodError: java.util.Properties: method
> setProperty(Ljava/lang
> /String;Ljava/lang/String;)Ljava/lang/Object; not found
> at junit.runner.BaseTestRunner.<init>(BaseTestRunner.java:157)
> at junit.textui.TestRunner.<init>(TestRunner.java:35)
> at junit.textui.TestRunner.main(TestRunner.java:87)
>
> while using JDK1.2.2 (or JDK1.3) everything works well.
>
> Is there any compatibility jar (or other tips) to support JDK 1.1.* ?
> Thanks for the attention

I had this same problem.  It ends up that the "put" method also works
(caveat: I haven't run some of the JUnit enclosed tests, I think), since
Properties objects are Hashtables.  I have a "mini-port" that reflects this.

If you (or anyone on the list) would like me to email you a copy or post it
somewhere, just let me know and I'll jar it up later today or tonight.

'Course, your "compatibility jar" mention makes me think: I suppose it might
be sufficient just to have a jar or class directory with the new
BaseTestRunner on the classpath before the regular junit.jar, instead of the
entire jarred-up JUnit.

Hope this helps,
Ben Schroeder
schroeder@...

#216 From: David Corbin <dcorbin@...>
Date: Tue Jan 9, 2001 6:03 pm
Subject: Re: Threaded test cases
dcorbin@...
Send Email Send Email
 
Robert Leftwich wrote:
>
> At 10:25 AM 08-01-01 -0500, you wrote:
> >In order to test certain aspects of my code, I essentially need to run
> >several threads, and have those threads assert serveral things.  Does
> >JUnit have direct support for such?  If not, any suggestions on how to
> >solve this?
>
> Have a look at
> http://www.javaworld.com/javaworld/jw-12-2000/jw-1221-junit-3.html which is
> page 3 of an article on JUnit best practice that mentions testing for
> thread-safety.
> A caveat - I haven't had time to read it properly yet, but I need to do
> some multi-threaded testing in the next day or 2, so let me know if it is
> useful :-)
>

It's not an issue of testing for thread safety.  It's an issue that I
need to test the behavior of a (remote) class from multiple clients.
Threading seemed like the way to to do this...

> Regards
>
> Robert
>
> To unsubscribe from this group, send an email to:
> junit-unsubscribe@egroups.com

--
David Corbin
Mach Turtle Technologies, Inc.
http://www.machturtle.com
dcorbin@...

#217 From: "Scott Eade" <seade@...>
Date: Tue Jan 9, 2001 10:12 pm
Subject: Re: JUNIT3.4 and JDK1.1.x support
seade@...
Send Email Send Email
 
To get JUnit 3.4 to run under jdk 1.1.8 you need to change the
initializer in junit.runner.BaseTestRunner by replacing the line:

         fPreferences.setProperty("loading", "true");

...as setProperty() is not supported by Properties objects in 1.1.8.
You can replace this line with the following:

         try {
             ByteArrayInputStream input = new
ByteArrayInputStream(("loading=true").getBytes("ASCII"));
             fPreferences.load(input);
         }
         catch (Exception e) {
             throw new RuntimeException("" + e);
         }

... which will achieve the same result.

I don't know of a way to override an initializer so the only way
to get this change in is to patch the existing class (please tell me
if there is a way).

There is actually a survey up on SourceForge asking whether
or not JUnit 3.5 should be the last version to support jdk 1.1.*
If support for 1.1.* is important to you then I suggest you fill
out the one question survey (mind you if support for 1.1.* is not
important to you then fill out the survey anyway so that the
results aren't skewed).

Cheers,

Scott

----- Original Message -----
From: <csampietro@...>
To: <junit@egroups.com>
Sent: Wednesday, January 10, 2001 2:14 AM
Subject: [junit] JUNIT3.4 and JDK1.1.x support


> Hi all eGroups members,
>
> is it possible to use JUnit 3.4 with JDK 1.1.* ?
>
> If I run it with JDK 1.1.8, I get the following error output:
>
> D:\junit3.4>e:\jdk1.1.8\bin\java -classpath
> e:\jdk1.1.8\lib\classes.zip;.\junit.
> jar;. junit.textui.TestRunner junit.samples.AllTests
> java.lang.NoSuchMethodError: java.util.Properties: method
> setProperty(Ljava/lang
> /String;Ljava/lang/String;)Ljava/lang/Object; not found
>         at junit.runner.BaseTestRunner.<init>(BaseTestRunner.java:157)
>         at junit.textui.TestRunner.<init>(TestRunner.java:35)
>         at junit.textui.TestRunner.main(TestRunner.java:87)
>
> while using JDK1.2.2 (or JDK1.3) everything works well.
>
> Is there any compatibility jar (or other tips) to support JDK 1.1.* ?
> Thanks for the attention
> Regards
> Carlo
>
>
>
> To unsubscribe from this group, send an email to:
> junit-unsubscribe@egroups.com
>
>
>
>

#218 From: "Scott Eade" <seade@...>
Date: Tue Jan 9, 2001 10:32 pm
Subject: Re: JUNIT3.4 and JDK1.1.x support
seade@...
Send Email Send Email
 
The setProperty problem has apparently been fixed in
JUnit 3.5 which I assume must not be too far away.

Scott

----- Original Message -----
From: "Scott Eade" <seade@...>
> To get JUnit 3.4 to run under jdk 1.1.8 you need to change the
> initializer in junit.runner.BaseTestRunner by replacing the line:
>
>         fPreferences.setProperty("loading", "true");
>
> ...as setProperty() is not supported by Properties objects in 1.1.8.

#219 From: csampietro@...
Date: Wed Jan 10, 2001 9:32 am
Subject: Re: JUNIT3.4 and JDK1.1.x support
csampietro@...
Send Email Send Email
 
--- In junit@egroups.com, Benjamin Schroeder <schroeder@s...> wrote:
> on 1/9/01 11:14 AM, csampietro@s... at csampietro@s...
> wrote:
>
> > Hi all eGroups members,
> >
> > is it possible to use JUnit 3.4 with JDK 1.1.* ?
> >
> > If I run it with JDK 1.1.8, I get the following error output:
> >
> > D:\junit3.4>e:\jdk1.1.8\bin\java -classpath
> > e:\jdk1.1.8\lib\classes.zip;.\junit.
> > jar;. junit.textui.TestRunner junit.samples.AllTests
> > java.lang.NoSuchMethodError: java.util.Properties: method
> > setProperty(Ljava/lang
> > /String;Ljava/lang/String;)Ljava/lang/Object; not found
> > at junit.runner.BaseTestRunner.<init>(BaseTestRunner.java:157)
> > at junit.textui.TestRunner.<init>(TestRunner.java:35)
> > at junit.textui.TestRunner.main(TestRunner.java:87)
> >
> > while using JDK1.2.2 (or JDK1.3) everything works well.
> >
> > Is there any compatibility jar (or other tips) to support JDK
1.1.* ?
> > Thanks for the attention
>
> I had this same problem.  It ends up that the "put" method also
works
> (caveat: I haven't run some of the JUnit enclosed tests, I think),
since
> Properties objects are Hashtables.  I have a "mini-port" that
reflects this.
>

Using the "put" and JDK1.1.8, instead of setProperty, TestRunner works
fine with almost samples tests; the following tests doesn't work:
* testError: it blocks on waitFor during execTest with getRuntime;
* testTestCaseClassLoader: it ends with a ClassNotFoundException


> If you (or anyone on the list) would like me to email you a copy or
post it
> somewhere, just let me know and I'll jar it up later today or
tonight.
>
> 'Course, your "compatibility jar" mention makes me think: I suppose
it might
> be sufficient just to have a jar or class directory with the new
> BaseTestRunner on the classpath before the regular junit.jar,
instead of the
> entire jarred-up JUnit.

You are right.
>
> Hope this helps,
> Ben Schroeder
> schroeder@s...

Thank you.
Regards.
Carlo Sampietro

#220 From: "APC " <andrew.clarke@...>
Date: Wed Jan 10, 2001 11:51 am
Subject: JUnit tests raise NoClassDefFoundError with log4j
andrew.clarke@...
Send Email Send Email
 
I am developing a program that uses the open source package log4j as
a logging tool.  my Junit tests ran green and clean until I
introduced calls to log4j.  the program compiles but when i run the
tests they fail with NoClassDefFoundError for the log4j components.

I'm raising this here because when I created a little class with a
main method to call my log() code it runs (sort of, it fails half
way thru' with a NullPointerException but I hope to resolve that).

So my question is: why doesn't JUnit like log4j?  Has anybody else
experienced something like this?  Do I need to alter my system
configuration?  Currently the log4j.jar is resident in my lib\ext
directory.

tia, APC

#221 From: Scott Coleman <scott.coleman@...>
Date: Wed Jan 10, 2001 11:58 am
Subject: Re: JUnit tests raise NoClassDefFoundError with log4j
scott.coleman@...
Send Email Send Email
 
Try putting the log4.jar file explicitly in the classpath when running the
tests.

scott
On Wed, 10 Jan 2001, you wrote:
> I am developing a program that uses the open source package log4j as
> a logging tool.  my Junit tests ran green and clean until I
> introduced calls to log4j.  the program compiles but when i run the
> tests they fail with NoClassDefFoundError for the log4j components.
>
> I'm raising this here because when I created a little class with a
> main method to call my log() code it runs (sort of, it fails half
> way thru' with a NullPointerException but I hope to resolve that).
>
> So my question is: why doesn't JUnit like log4j?  Has anybody else
> experienced something like this?  Do I need to alter my system
> configuration?  Currently the log4j.jar is resident in my lib\ext
> directory.
>
> tia, APC
>
>
>
> To unsubscribe from this group, send an email to:
> junit-unsubscribe@egroups.com
--
----------------------------------
Scott Coleman
Software Engineer
Mobile: 00420 723 03 62 27
Land Line: 00420 221 970 231
Fax: 00420 221 970 241
Pstrossova 24
11 000 Praha 1
Czech Republic
scott.coleman@...

#222 From: Andrew Clarke <andrew.clarke@...>
Date: Wed Jan 10, 2001 12:02 pm
Subject: RE: JUnit tests raise NoClassDefFoundError with log4j
andrew.clarke@...
Send Email Send Email
 
I have tried that.  I didn't make any difference.

Regards, APC

-----Original Message-----
From: Scott Coleman [mailto:scott.coleman@...]
Sent: 10 January 2001 11:58
To: junit@egroups.com
Subject: Re: [junit] JUnit tests raise NoClassDefFoundError with log4j


Try putting the log4.jar file explicitly in the classpath when running the
tests.

scott
On Wed, 10 Jan 2001, you wrote:
> I am developing a program that uses the open source package log4j as
> a logging tool.  my Junit tests ran green and clean until I
> introduced calls to log4j.  the program compiles but when i run the
> tests they fail with NoClassDefFoundError for the log4j components.
>
> I'm raising this here because when I created a little class with a
> main method to call my log() code it runs (sort of, it fails half
> way thru' with a NullPointerException but I hope to resolve that).
>
> So my question is: why doesn't JUnit like log4j?  Has anybody else
> experienced something like this?  Do I need to alter my system
> configuration?  Currently the log4j.jar is resident in my lib\ext
> directory.
>
> tia, APC
>
>
>
> To unsubscribe from this group, send an email to:
> junit-unsubscribe@egroups.com
--
----------------------------------
Scott Coleman
Software Engineer
Mobile: 00420 723 03 62 27
Land Line: 00420 221 970 231
Fax: 00420 221 970 241
Pstrossova 24
11 000 Praha 1
Czech Republic
scott.coleman@...

To unsubscribe from this group, send an email to:
junit-unsubscribe@egroups.com

#223 From: G Ramasubramani <grama@...>
Date: Wed Jan 10, 2001 12:03 pm
Subject: Re: JUnit tests raise NoClassDefFoundError with log4j
grama@...
Send Email Send Email
 
try putting a file in your user.home directory called junit.properties with
this line in it -

loading=false

if the solution given below does not work out.

Rama'




Scott Coleman wrote:

> Try putting the log4.jar file explicitly in the classpath when running the
> tests.
>
> scott
> On Wed, 10 Jan 2001, you wrote:
> > I am developing a program that uses the open source package log4j as
> > a logging tool.  my Junit tests ran green and clean until I
> > introduced calls to log4j.  the program compiles but when i run the
> > tests they fail with NoClassDefFoundError for the log4j components.
> >
> > I'm raising this here because when I created a little class with a
> > main method to call my log() code it runs (sort of, it fails half
> > way thru' with a NullPointerException but I hope to resolve that).
> >
> > So my question is: why doesn't JUnit like log4j?  Has anybody else
> > experienced something like this?  Do I need to alter my system
> > configuration?  Currently the log4j.jar is resident in my lib\ext
> > directory.
> >
> > tia, APC
> >
> >
> >
> > To unsubscribe from this group, send an email to:
> > junit-unsubscribe@egroups.com
> --
> ----------------------------------
> Scott Coleman
> Software Engineer
> Mobile: 00420 723 03 62 27
> Land Line: 00420 221 970 231
> Fax: 00420 221 970 241
> Pstrossova 24
> 11 000 Praha 1
> Czech Republic
> scott.coleman@...
>
> To unsubscribe from this group, send an email to:
> junit-unsubscribe@egroups.com

#224 From: Andrew Clarke <andrew.clarke@...>
Date: Wed Jan 10, 2001 12:27 pm
Subject: RE: JUnit tests raise NoClassDefFoundError with log4j
andrew.clarke@...
Send Email Send Email
 
if by "user.home directory" you meant my java home then this didn't work
either.  should i try some other directory?

thank you for your thoughts, APC

-----Original Message-----
From: G Ramasubramani [mailto:grama@...]
Sent: 10 January 2001 12:04
To: junit@egroups.com
Subject: Re: [junit] JUnit tests raise NoClassDefFoundError with log4j


try putting a file in your user.home directory called junit.properties with
this line in it -

loading=false

if the solution given below does not work out.

Rama'




Scott Coleman wrote:

> Try putting the log4.jar file explicitly in the classpath when running the
> tests.
>
> scott
> On Wed, 10 Jan 2001, you wrote:
> > I am developing a program that uses the open source package log4j as
> > a logging tool.  my Junit tests ran green and clean until I
> > introduced calls to log4j.  the program compiles but when i run the
> > tests they fail with NoClassDefFoundError for the log4j components.
> >
> > I'm raising this here because when I created a little class with a
> > main method to call my log() code it runs (sort of, it fails half
> > way thru' with a NullPointerException but I hope to resolve that).
> >
> > So my question is: why doesn't JUnit like log4j?  Has anybody else
> > experienced something like this?  Do I need to alter my system
> > configuration?  Currently the log4j.jar is resident in my lib\ext
> > directory.
> >
> > tia, APC
> >
> >
> >
> > To unsubscribe from this group, send an email to:
> > junit-unsubscribe@egroups.com
> --
> ----------------------------------
> Scott Coleman
> Software Engineer
> Mobile: 00420 723 03 62 27
> Land Line: 00420 221 970 231
> Fax: 00420 221 970 241
> Pstrossova 24
> 11 000 Praha 1
> Czech Republic
> scott.coleman@...
>
> To unsubscribe from this group, send an email to:
> junit-unsubscribe@egroups.com


To unsubscribe from this group, send an email to:
junit-unsubscribe@egroups.com

#225 From: Scott Coleman <scott.coleman@...>
Date: Wed Jan 10, 2001 12:30 pm
Subject: RE: JUnit tests raise NoClassDefFoundError with log4j
scott.coleman@...
Send Email Send Email
 
user.home is your home directory on NT but you can quickly test what user.home"
is by writing a main method which calls System.getProperties and then list this
using the list method to System.out.


Scott

  On Wed, 10 Jan 2001, you wrote: > if by
"user.home directory" you meant my java home then this didn't work > either.
should i try some other directory? >
> thank you for your thoughts, APC
>
> -----Original Message-----
> From: G Ramasubramani [mailto:grama@...]
> Sent: 10 January 2001 12:04
> To: junit@egroups.com
> Subject: Re: [junit] JUnit tests raise NoClassDefFoundError with log4j
>
>
> try putting a file in your user.home directory called junit.properties
> with
> this line in it -
>
> loading=false
>
> if the solution given below does not work out.
>
> Rama'
>
>
>
>
> Scott Coleman wrote:
>
> > Try putting the log4.jar file explicitly in the classpath when running
> the
> > tests.
> >
> > scott
> > On Wed, 10 Jan 2001, you wrote:
> > > I am developing a program that uses the open source package log4j as
> > > a logging tool.  my Junit tests ran green and clean until I
> > > introduced calls to log4j.  the program compiles but when i run the
> > > tests they fail with NoClassDefFoundError for the log4j components.
> > >
> > > I'm raising this here because when I created a little class with a
> > > main method to call my log() code it runs (sort of, it fails half
> > > way thru' with a NullPointerException but I hope to resolve that).
> > >
> > > So my question is: why doesn't JUnit like log4j?  Has anybody else
> > > experienced something like this?  Do I need to alter my system
> > > configuration?  Currently the log4j.jar is resident in my lib\ext
> > > directory.
> > >
> > > tia, APC
> > >
> > >
> > >
> > > To unsubscribe from this group, send an email to:
> > > junit-unsubscribe@egroups.com
> > --
> > ----------------------------------
> > Scott Coleman
> > Software Engineer
> > Mobile: 00420 723 03 62 27
> > Land Line: 00420 221 970 231
> > Fax: 00420 221 970 241
> > Pstrossova 24
> > 11 000 Praha 1
> > Czech Republic
> > scott.coleman@...
> >
> > To unsubscribe from this group, send an email to:
> > junit-unsubscribe@egroups.com
>
>
> To unsubscribe from this group, send an email to:
> junit-unsubscribe@egroups.com
>
>
>
> To unsubscribe from this group, send an email to:
> junit-unsubscribe@egroups.com
--
----------------------------------
Scott Coleman
Software Engineer
Mobile: 00420 723 03 62 27
Land Line: 00420 221 970 231
Fax: 00420 221 970 241
Pstrossova 24
11 000 Praha 1
Czech Republic
scott.coleman@...

#226 From: G Ramasubramani <grama@...>
Date: Wed Jan 10, 2001 12:36 pm
Subject: Re: JUnit tests raise NoClassDefFoundError with log4j
grama@...
Send Email Send Email
 
By user.home I meant the value of the java System property 'user.home' on
your VM.

     This might not solve the problem as this step is merely to tell junit to use
only one class loader. However, you can give it a shot.

thanks,
Rama

Andrew Clarke wrote:

> if by "user.home directory" you meant my java home then this didn't work
> either.  should i try some other directory?
>
> thank you for your thoughts, APC
>
> -----Original Message-----
> From: G Ramasubramani [mailto:grama@...]
> Sent: 10 January 2001 12:04
> To: junit@egroups.com
> Subject: Re: [junit] JUnit tests raise NoClassDefFoundError with log4j
>
> try putting a file in your user.home directory called junit.properties with
> this line in it -
>
> loading=false
>
> if the solution given below does not work out.
>
> Rama'
>
> Scott Coleman wrote:
>
> > Try putting the log4.jar file explicitly in the classpath when running the
> > tests.
> >
> > scott
> > On Wed, 10 Jan 2001, you wrote:
> > > I am developing a program that uses the open source package log4j as
> > > a logging tool.  my Junit tests ran green and clean until I
> > > introduced calls to log4j.  the program compiles but when i run the
> > > tests they fail with NoClassDefFoundError for the log4j components.
> > >
> > > I'm raising this here because when I created a little class with a
> > > main method to call my log() code it runs (sort of, it fails half
> > > way thru' with a NullPointerException but I hope to resolve that).
> > >
> > > So my question is: why doesn't JUnit like log4j?  Has anybody else
> > > experienced something like this?  Do I need to alter my system
> > > configuration?  Currently the log4j.jar is resident in my lib\ext
> > > directory.
> > >
> > > tia, APC
> > >
> > >
> > >
> > > To unsubscribe from this group, send an email to:
> > > junit-unsubscribe@egroups.com
> > --
> > ----------------------------------
> > Scott Coleman
> > Software Engineer
> > Mobile: 00420 723 03 62 27
> > Land Line: 00420 221 970 231
> > Fax: 00420 221 970 241
> > Pstrossova 24
> > 11 000 Praha 1
> > Czech Republic
> > scott.coleman@...
> >
> > To unsubscribe from this group, send an email to:
> > junit-unsubscribe@egroups.com
>
> To unsubscribe from this group, send an email to:
> junit-unsubscribe@egroups.com
>
> To unsubscribe from this group, send an email to:
> junit-unsubscribe@egroups.com

#227 From: "Brian Button" <bbutton01@...>
Date: Wed Jan 10, 2001 2:12 pm
Subject: RE: JUnit tests raise NoClassDefFoundError with log4j
bbutton01@...
Send Email Send Email
 
Andrew,

You don't say if you are using junit 3.2 or 3.4. If it is 3.2, then the
problem is more than likely that that version of the tool doesn't know how
to find classes that are in jar files using its custom class loader. There
are instructions somewhere in the doc directory about how to tell the class
loader not to try to load these classes, but to defer their loading to the
system class loader.

If you're using 3.4, then we need to talk more :)

bab

----
Brian Button       bbutton@...
Senior Consultant  Object Mentor, Inc.
St. Louis, MO      http://www.objectmentor.com

> -----Original Message-----
> From: APC [mailto:andrew.clarke@...]
> Sent: Wednesday, January 10, 2001 5:52 AM
> To: junit@egroups.com
> Subject: [junit] JUnit tests raise NoClassDefFoundError with log4j
>
>
> I am developing a program that uses the open source package log4j as
> a logging tool.  my Junit tests ran green and clean until I
> introduced calls to log4j.  the program compiles but when i run the
> tests they fail with NoClassDefFoundError for the log4j components.
>
> I'm raising this here because when I created a little class with a
> main method to call my log() code it runs (sort of, it fails half
> way thru' with a NullPointerException but I hope to resolve that).
>
> So my question is: why doesn't JUnit like log4j?  Has anybody else
> experienced something like this?  Do I need to alter my system
> configuration?  Currently the log4j.jar is resident in my lib\ext
> directory.
>
> tia, APC
>
>
>
> To unsubscribe from this group, send an email to:
> junit-unsubscribe@egroups.com
>
>
>
>

#228 From: Andrew Clarke <andrew.clarke@...>
Date: Wed Jan 10, 2001 4:36 pm
Subject: RE: JUnit tests raise NoClassDefFoundError with log4j
andrew.clarke@...
Send Email Send Email
 
Brian

I was using 3.2.  I've had a look in the FAQ and found the relevant passage.
The problem is I can't find the junit.util.excluded.properties file so that
I can exclude log4j. Where ought it to be?

Incidentally, I've now downloaded Junit 3.4 which I was going to use
instead.  However the sourceforge download doesn't have any of the
TestRunner classes.  However some of the postings on this list imply that
3.4 *does* have the UI components.  Where can I find them?

I'm sorry to keep asking questions, I guess I've got my stupid head on
today.  thanks for your time, APC

-----Original Message-----
From: Brian Button [mailto:bbutton01@...]
Sent: 10 January 2001 14:12
To: junit@egroups.com
Subject: RE: [junit] JUnit tests raise NoClassDefFoundError with log4j


Andrew,

You don't say if you are using junit 3.2 or 3.4. If it is 3.2, then the
problem is more than likely that that version of the tool doesn't know how
to find classes that are in jar files using its custom class loader. There
are instructions somewhere in the doc directory about how to tell the class
loader not to try to load these classes, but to defer their loading to the
system class loader.

If you're using 3.4, then we need to talk more :)

bab

----
Brian Button       bbutton@...
Senior Consultant  Object Mentor, Inc.
St. Louis, MO      http://www.objectmentor.com

> -----Original Message-----
> From: APC [mailto:andrew.clarke@...]
> Sent: Wednesday, January 10, 2001 5:52 AM
> To: junit@egroups.com
> Subject: [junit] JUnit tests raise NoClassDefFoundError with log4j
>
>
> I am developing a program that uses the open source package log4j as
> a logging tool.  my Junit tests ran green and clean until I
> introduced calls to log4j.  the program compiles but when i run the
> tests they fail with NoClassDefFoundError for the log4j components.
>
> I'm raising this here because when I created a little class with a
> main method to call my log() code it runs (sort of, it fails half
> way thru' with a NullPointerException but I hope to resolve that).
>
> So my question is: why doesn't JUnit like log4j?  Has anybody else
> experienced something like this?  Do I need to alter my system
> configuration?  Currently the log4j.jar is resident in my lib\ext
> directory.
>
> tia, APC
>
>
>
> To unsubscribe from this group, send an email to:
> junit-unsubscribe@egroups.com
>
>
>
>


To unsubscribe from this group, send an email to:
junit-unsubscribe@egroups.com

#229 From: "Scott Eade" <seade@...>
Date: Wed Jan 10, 2001 9:35 pm
Subject: Re: JUnit tests raise NoClassDefFoundError with log4j
seade@...
Send Email Send Email
 
Andrew Clarke wrote:
> Incidentally, I've now downloaded Junit 3.4 which I was going to use
> instead.  However the sourceforge download doesn't have any of the
> TestRunner classes.  However some of the postings on this list imply that
> 3.4 *does* have the UI components.  Where can I find them?

I think you will find that it does have the TestRunner classes but not the
javadoc for them.  You can extract the source and generate the full
javadoc yourself if you need it.

Scott

#230 From: Faisal <faisalm@...>
Date: Thu Jan 11, 2001 12:54 am
Subject: Using args variables for testcases
faisalm@...
Send Email Send Email
 
Hi Everyone,

I am new to junit, and I already have a test suite that I use for my
functional test. As part
of starting my tests I pass the IOR for the CORBA ORB via the args.
e.g.

       java Function   -ORBInitRef RfxContext=`cat
/e1/apps/tranxact/tmp/rfx.ior`


I would like to do the same through via the AllTest, which in turn would
pass it to
my Test class.

Any ideas.

Thanks,

Faisal.

#231 From: "Brian Button" <bbutton01@...>
Date: Thu Jan 11, 2001 5:18 am
Subject: RE: JUnit tests raise NoClassDefFoundError with log4j
bbutton01@...
Send Email Send Email
 
I use 3.4 all the time. The only difference between the TestRunners in it
and 3.2 are that the Loading version are gone, and the regular
junit.swingui.TestRunner and junit.ui.TestRunner have that functionality
built into them.

BTW, the excluded.properties file should be inside junit.jar. Just extract
that, update that file, and readd it to the jar. Now that you have 3.4,
however, kindly disregard this paragraph :)

Happy to help,
bab

----
Brian Button       bbutton@...
Senior Consultant  Object Mentor, Inc.
St. Louis, MO      http://www.objectmentor.com

> -----Original Message-----
> From: Andrew Clarke [mailto:andrew.clarke@...]
> Sent: Wednesday, January 10, 2001 10:36 AM
> To: junit@egroups.com
> Subject: RE: [junit] JUnit tests raise NoClassDefFoundError with log4j
>
>
> Brian
>
> I was using 3.2.  I've had a look in the FAQ and found the
> relevant passage.
> The problem is I can't find the
> junit.util.excluded.properties file so that
> I can exclude log4j. Where ought it to be?
>
> Incidentally, I've now downloaded Junit 3.4 which I was going to use
> instead.  However the sourceforge download doesn't have any of the
> TestRunner classes.  However some of the postings on this
> list imply that
> 3.4 *does* have the UI components.  Where can I find them?
>
> I'm sorry to keep asking questions, I guess I've got my stupid head on
> today.  thanks for your time, APC

#232 From: Scott Coleman <scott.coleman@...>
Date: Thu Jan 11, 2001 7:28 am
Subject: Re: Using args variables for testcases
scott.coleman@...
Send Email Send Email
 
Why not make it a -D option so that you can use system.getProperty ??


On Thu, 11 Jan 2001, you wrote:
> Hi Everyone,
>
> I am new to junit, and I already have a test suite that I use for my
> functional test. As part
> of starting my tests I pass the IOR for the CORBA ORB via the args.
> e.g.
>
>       java Function   -ORBInitRef RfxContext=`cat
> /e1/apps/tranxact/tmp/rfx.ior`
>
>
> I would like to do the same through via the AllTest, which in turn would
> pass it to
> my Test class.
>
> Any ideas.
>
> Thanks,
>
> Faisal.
>
>
>
> To unsubscribe from this group, send an email to:
> junit-unsubscribe@egroups.com
--
----------------------------------
Scott Coleman
Software Engineer
Mobile: 00420 723 03 62 27
Land Line: 00420 221 970 231
Fax: 00420 221 970 241
Pstrossova 24
11 000 Praha 1
Czech Republic
scott.coleman@...

#233 From: Andrew Clarke <andrew.clarke@...>
Date: Thu Jan 11, 2001 9:24 am
Subject: RE: JUnit tests raise NoClassDefFoundError with log4j
andrew.clarke@...
Send Email Send Email
 
Brian, Scott and everybody

Using Junit3.4 has solved the problem.  Well, half my errors have gone.  Now
I need to clean up those others.

Thanks, APC



-----Original Message-----
From: Brian Button [mailto:bbutton01@...]
Sent: 11 January 2001 05:18
To: junit@egroups.com
Subject: RE: [junit] JUnit tests raise NoClassDefFoundError with log4j


I use 3.4 all the time. The only difference between the TestRunners in it
and 3.2 are that the Loading version are gone, and the regular
junit.swingui.TestRunner and junit.ui.TestRunner have that functionality
built into them.

BTW, the excluded.properties file should be inside junit.jar. Just extract
that, update that file, and readd it to the jar. Now that you have 3.4,
however, kindly disregard this paragraph :)

Happy to help,
bab

----
Brian Button       bbutton@...
Senior Consultant  Object Mentor, Inc.
St. Louis, MO      http://www.objectmentor.com

> -----Original Message-----
> From: Andrew Clarke [mailto:andrew.clarke@...]
> Sent: Wednesday, January 10, 2001 10:36 AM
> To: junit@egroups.com
> Subject: RE: [junit] JUnit tests raise NoClassDefFoundError with log4j
>
>
> Brian
>
> I was using 3.2.  I've had a look in the FAQ and found the
> relevant passage.
> The problem is I can't find the
> junit.util.excluded.properties file so that
> I can exclude log4j. Where ought it to be?
>
> Incidentally, I've now downloaded Junit 3.4 which I was going to use
> instead.  However the sourceforge download doesn't have any of the
> TestRunner classes.  However some of the postings on this
> list imply that
> 3.4 *does* have the UI components.  Where can I find them?
>
> I'm sorry to keep asking questions, I guess I've got my stupid head on
> today.  thanks for your time, APC


To unsubscribe from this group, send an email to:
junit-unsubscribe@egroups.com

#234 From: owen@...
Date: Thu Jan 11, 2001 4:33 pm
Subject: Why did junit.swingui.TestRunner's start() change?
owen@...
Send Email Send Email
 
junit.swingui.TestRunner used to have a start method with the
following signature:

     void start( String[] p0, TestSuiteLoader p1 )

However, now in junit3.4 I've noticed the start method's signature
is:

     void start( String[] )

I'm having a problem getting the GUI TestRunner to run a batch of
test suites (the same code with the text TestRunner works fine).  I'm
hoping information about why the start method changed may point me
towards something that will help me get my test suites running with
the GUI TestRunner.

Does anyone know why start() changed?

#235 From: "Kent Beck" <kentbeck@...>
Date: Sat Jan 13, 2001 12:44 am
Subject: Re: test with private methd
kentbeck@...
Send Email Send Email
 
The other alternative is not to test private methods directly. This
will require you to rethink your design. Every time I've taken the
time to think about visibility because of testing, I've found
valuable insight into the design as a whole, and my need to test
private methods has disappeared, either because they become public or
because they move to another class where they are public.

Kent

#236 From: Kevin Bourrillion <kevinb@...>
Date: Sat Jan 13, 2001 1:30 am
Subject: RE: Re: test with private methd
kevinb@...
Send Email Send Email
 
Thanks Kent,
 
I think the issue is not just testing private methods, which I agree shouldn't be necessary.  But, often times even when I'm testing a public method there are other methods I need to call just to see whether the one I'm testing did what it was supposed to do.  And sometimes these "testability methods" are ones I would never want production code to invoke and mess up my encapsulation.  So you can't make em private, and you can't make em not private!  Hence the need for some trick like the ones that were suggested.
 
Kevin

-----Original Message-----
From: Kent Beck [mailto:kentbeck@...]
Sent: Friday, January 12, 2001 4:44 PM
To: junit@egroups.com
Subject: [junit] Re: test with private methd

The other alternative is not to test private methods directly. This
will require you to rethink your design. Every time I've taken the
time to think about visibility because of testing, I've found
valuable insight into the design as a whole, and my need to test
private methods has disappeared, either because they become public or
because they move to another class where they are public.

Kent



To unsubscribe from this group, send an email to:
junit-unsubscribe@egroups.com



#237 From: charliehubbard76@...
Date: Mon Jan 15, 2001 4:25 am
Subject: Re: test with private methd
charliehubbard76@...
Send Email Send Email
 
--- In junit@egroups.com, Kevin Bourrillion <kevinb@m...> wrote:
> Thanks Kent,
>
> I think the issue is not just testing private methods, which I agree
> shouldn't be necessary.  But, often times even when I'm testing a
> public method there are other methods I need to call just to see
> whether the one I'm testing did what it was supposed to do.  And
> sometimes these "testability methods" are ones I would never want
> production code to invoke and mess up my encapsulation.  So you
> can't make em private, and you can't make em not private!  Hence
> the need for some trick like the ones that were
> suggested.

When I'm testing things that require me to call private/protected
methods I find it easiest to use reflection to open up a class so I
can call some method or check some contents of an instance.  I built
a simple class called UnitTestAccessor which uses reflection to break
open instances allowing me to call any method I wish or check any
data I need.

Great example of using this was to test a Runnable that spun in a
loop calling some protected methods to perform analysis.  Since it
was hard to test across threads I used the UnitTestAccessor to
simulate thread calls into these protected methods.  I'll post this
class tomorrow as I don't have the code at my disposal right now. 8)

--charlie

#238 From: "Paul Holser" <pholser@...>
Date: Mon Jan 15, 2001 3:52 pm
Subject: idiom for signalling setUp() problems?
pholser@...
Send Email Send Email
 
i've modified an abstract test class we created on our project
that provides a base for people writing tests for classes
which override equals() and hashCode().  the idea is to
let subclasses provide instances of the class under test
to use for comparison by implementing abstract createInstance()
and createNotEqualInstance() methods to return new instances of
the test class, where the instances created by createInstance()
are to compare equal, and the instances created by
createNotEqualsInstance() are to compare unequal to those from
createInstance().

the abstract test class' setUp() calls createInstance() three
times, and createNotEqualInstance() once.  then the (final)
test methods run the instances through the provisions of the
equals()/hashCode() contract (transitivity, symmetry, etc.).

now, after creating the instances in setUp(), i want to make
some basic assertions:

-- none of the instances is null
-- all the instances are distinct
-- all the instances are of the same class

is it pretty standard to do this with assert() methods in
setUp() code?  i guess if you consider each test method in
your test class to be put through the setUp()/run()/tearDown()
cycle, this flies, since the assertion just bails out before
the execution of each test method, labelling the test failed.

or, is it more accepted to throw an error that would indicate
a problem with the test code itself (thus not a "failure",
but an "error")?

thanks for your input,
p

#239 From: Robert Sartin <sartin@...>
Date: Mon Jan 15, 2001 4:36 pm
Subject: Re: idiom for signalling setUp() problems?
sartin@...
Send Email Send Email
 
>now, after creating the instances in setUp(), i want to make
>ome basic assertions:

Well, if I'm being pedantic I'd prefer to see setUp failures appear as
Error rather than Failure, so I'd rather have setUp through some other
Exception. Wouldn't It Be Nice If:

-here were Test methods that did assertions, but threw some other
Exception?

or

-AssertionFailedError thrown during setUp or tearDown were treated as
an Error rather than a Failure?

Regards,

Rob


__________________________________________________
Do You Yahoo!?
Get email at your own domain with Yahoo! Mail.
http://personal.mail.yahoo.com/

#240 From: "Paul Holser" <pholser@...>
Date: Mon Jan 15, 2001 5:06 pm
Subject: Re: idiom for signalling setUp() problems?
pholser@...
Send Email Send Email
 
--- In junit@egroups.com, Robert Sartin <sartin@a...> wrote:
> -AssertionFailedError thrown during setUp or tearDown were treated
> as an Error rather than a Failure?

this is what i'd like to see...

--p

#241 From: jakob@...
Date: Mon Jan 15, 2001 11:52 pm
Subject: Re: test with private methd
jakob@...
Send Email Send Email
 
Hi There.

Very often you don't need methods to be "private" to protect them
from being called from the outside, but "protected" will do the job,
allowing access only to the class + subclasses of it.

Here's then some simple suggestions:

A.1) Create a subclass of the class you want to test. Put this class
in your test package.

A.2) Create a simple delegation method in the subclass with public
access that calls the protected method. You can also put this method
directly in the class you want to test, and just remove it before
releasing. This causes a lot of out commenting though :-)

And something I sometimes do before testing smaller areas...

B.1) change the method access to public for the duration of the test.
Then change it back to private. This also gives some problems in,
that you cannot execute automatic tests.


If these suggestions won't do, I see no other way than looking into
what reflection might do for you.

Regards,
Jakob Jenkov

#242 From: "Simon A. Crase" <simon_crase@...>
Date: Tue Jan 16, 2001 11:36 am
Subject: Re: test with private methd
simon_crase@...
Send Email Send Email
 
Jakob Jenkov wrote:
> Very often you don't need methods to be "private" to protect them
> from being called from the outside, but "protected" will do the job,
> allowing access only to the class + subclasses of it.
>
> Here's then some simple suggestions:
>
> A.1) Create a subclass of the class you want to test. Put this class
> in your test package.
I have just started using JUnit, so this may be naive, but...

What is wrong with using protected - as Jakob suggests - and putting all the
tests for
a package in the package itself?


Cheers,


Simon

#243 From: "Gael Marziou" <gael_marziou@...>
Date: Tue Jan 16, 2001 6:47 pm
Subject: Confused about J2EEUnit, JunitEE and JUnitServlet
gael_marziou@...
Send Email Send Email
 
Hello,

I am in the process of unit testing some classes on server side.
Having a quick look around, I found 3 extensions to junit that could
fit: J2EEUnit, JunitEE and JUnitServlet.

It's not clear whether those are competitors or complementary.

J2EEUnit seems to be kind of blessed by JUnit by being referenced
from JUnit home page.

Any feedback would be appreciated, my main concern is to choose the
right one to invest time in learning and using it.

Thanks,

Gael

Messages 214 - 243 of 24387   Oldest  |  < Older  |  Newer >  |  Newest
Add to My Yahoo!      XML What's This?

Copyright © 2010 Yahoo! Inc. All rights reserved.
Privacy Policy - Terms of Service - Guidelines NEW - Help