Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Java > Help with junit setup

Reply
Thread Tools

Help with junit setup

 
 
eggie5
Guest
Posts: n/a
 
      10-08-2007
I unzipped junit src to /usr/local/junit4.4

I then added it to my class path like so:

export JUNIT_HOME=/usr/local/src/junit4.4
export CLASSPATH=$JUNIT_HOME/junit-4.4.jar

However when I run: java junit.textui.TestRunner
junit.samples.AllTests

I get this error:

Class not found "junit.samples.AllTests"

What's wrong with my setup?

 
Reply With Quote
 
 
 
 
Manish Pandit
Guest
Posts: n/a
 
      10-08-2007
On Oct 8, 2:44 pm, eggie5 <(E-Mail Removed)> wrote:
> I unzipped junit src to /usr/local/junit4.4
>
> I then added it to my class path like so:
>
> export JUNIT_HOME=/usr/local/src/junit4.4
> export CLASSPATH=$JUNIT_HOME/junit-4.4.jar
>
> However when I run: java junit.textui.TestRunner
> junit.samples.AllTests
>
> I get this error:
>
> Class not found "junit.samples.AllTests"
>
> What's wrong with my setup?



Where are the binaries ? Is there a junit-4.4.jar in /usr/local/src/
junit4.4 ?

-cheers,
Manish

 
Reply With Quote
 
 
 
 
eggie5
Guest
Posts: n/a
 
      10-08-2007
On Oct 8, 4:18 pm, Manish Pandit <(E-Mail Removed)> wrote:
> On Oct 8, 2:44 pm, eggie5 <(E-Mail Removed)> wrote:
>
> > I unzipped junit src to /usr/local/junit4.4

>
> > I then added it to my class path like so:

>
> > export JUNIT_HOME=/usr/local/src/junit4.4
> > export CLASSPATH=$JUNIT_HOME/junit-4.4.jar

>
> > However when I run: java junit.textui.TestRunner
> > junit.samples.AllTests

>
> > I get this error:

>
> > Class not found "junit.samples.AllTests"

>
> > What's wrong with my setup?

>
> Where are the binaries ? Is there a junit-4.4.jar in /usr/local/src/
> junit4.4 ?
>
> -cheers,
> Manish


the junit jar is in /usr/local/src/junit4.4/

 
Reply With Quote
 
Manish Pandit
Guest
Posts: n/a
 
      10-08-2007
On Oct 8, 4:40 pm, eggie5 <(E-Mail Removed)> wrote:
>
> the junit jar is in /usr/local/src/junit4.4/- Hide quoted text -
>
> - Show quoted text -


The samples are not in junit-4.4.jar. They are in the Junit
installation folder. Try adding the installation folder to classpath
and see if it works..

-cheers,
Manish

 
Reply With Quote
 
eggie5
Guest
Posts: n/a
 
      10-09-2007
On Oct 8, 4:49 pm, Manish Pandit <(E-Mail Removed)> wrote:
> On Oct 8, 4:40 pm, eggie5 <(E-Mail Removed)> wrote:
>
>
>
> > the junit jar is in /usr/local/src/junit4.4/- Hide quoted text -

>
> > - Show quoted text -

>
> The samples are not in junit-4.4.jar. They are in the Junit
> installation folder. Try adding the installation folder to classpath
> and see if it works..
>
> -cheers,
> Manish


export JUNIT_HOME=/usr/local/src/junit4.4
export CLASSPATH=$JUNIT_HOME/junit-4.4.jar

What do I need to change?


 
Reply With Quote
 
eggie5
Guest
Posts: n/a
 
      10-09-2007
On Oct 8, 9:23 pm, eggie5 <(E-Mail Removed)> wrote:
> On Oct 8, 4:49 pm, Manish Pandit <(E-Mail Removed)> wrote:
>
> > On Oct 8, 4:40 pm, eggie5 <(E-Mail Removed)> wrote:

>
> > > the junit jar is in /usr/local/src/junit4.4/- Hide quoted text -

>
> > > - Show quoted text -

>
> > The samples are not in junit-4.4.jar. They are in the Junit
> > installation folder. Try adding the installation folder to classpath
> > and see if it works..

>
> > -cheers,
> > Manish

>
> export JUNIT_HOME=/usr/local/src/junit4.4
> export CLASSPATH=$JUNIT_HOME/junit-4.4.jar
>
> What do I need to change?


I figured it out:

This is what I have on my (os x) .bashrc file:

export JUNIT_HOME=/Users/eggie5/desktop/downloads/junit4.4
export CLASSPATH=$CLASSPATH:$JUNIT_HOME/junit-4.4.jar:$JUNIT_HOME


 
Reply With Quote
 
eggie5
Guest
Posts: n/a
 
      10-09-2007
On Oct 8, 9:53 pm, eggie5 <(E-Mail Removed)> wrote:
> On Oct 8, 9:23 pm, eggie5 <(E-Mail Removed)> wrote:
>
>
>
> > On Oct 8, 4:49 pm, Manish Pandit <(E-Mail Removed)> wrote:

>
> > > On Oct 8, 4:40 pm, eggie5 <(E-Mail Removed)> wrote:

>
> > > > the junit jar is in /usr/local/src/junit4.4/- Hide quoted text -

>
> > > > - Show quoted text -

>
> > > The samples are not in junit-4.4.jar. They are in the Junit
> > > installation folder. Try adding the installation folder to classpath
> > > and see if it works..

>
> > > -cheers,
> > > Manish

>
> > export JUNIT_HOME=/usr/local/src/junit4.4
> > export CLASSPATH=$JUNIT_HOME/junit-4.4.jar

>
> > What do I need to change?

>
> I figured it out:
>
> This is what I have on my (os x) .bashrc file:
>
> export JUNIT_HOME=/Users/eggie5/desktop/downloads/junit4.4
> export CLASSPATH=$CLASSPATH:$JUNIT_HOME/junit-4.4.jar:$JUNIT_HOME


Can I just add $JUNIT_HOME to the classpath? Will it be picked up?

 
Reply With Quote
 
eggie5
Guest
Posts: n/a
 
      10-09-2007
On Oct 8, 4:49 pm, Manish Pandit <(E-Mail Removed)> wrote:
> On Oct 8, 4:40 pm, eggie5 <(E-Mail Removed)> wrote:
>
>
>
> > the junit jar is in /usr/local/src/junit4.4/- Hide quoted text -

>
> > - Show quoted text -

>
> The samples are not in junit-4.4.jar. They are in the Junit
> installation folder. Try adding the installation folder to classpath
> and see if it works..
>
> -cheers,
> Manish


Now I'm having trouble running my tests:

~/Development/jmms_service/bin/com/tm/Services/MMS eggie5$ java
org.junit.runner.JUnitCore ServiceTest
JUnit version 4.4
Exception in thread "main" java.lang.NoClassDefFoundError: ServiceTest
(wrong name: com/tm/Services/MMS/ServiceTest)
at java.lang.ClassLoader.defineClass1(Native Method)
at java.lang.ClassLoader.defineClass(ClassLoader.java :620)
at
java.security.SecureClassLoader.defineClass(Secure ClassLoader.java:
124)
at java.net.URLClassLoader.defineClass(URLClassLoader .java:
260)
at java.net.URLClassLoader.access$100(URLClassLoader. java:56)
at java.net.URLClassLoader$1.run(URLClassLoader.java: 195)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.j ava:18
at java.lang.ClassLoader.loadClass(ClassLoader.java:3 06)
at sun.misc.Launcher$AppClassLoader.loadClass(Launche r.java:
26
at java.lang.ClassLoader.loadClass(ClassLoader.java:2 51)
at java.lang.ClassLoader.loadClassInternal(ClassLoade r.java:
319)
at java.lang.Class.forName0(Native Method)
at java.lang.Class.forName(Class.java:164)
at org.junit.runner.JUnitCore.runMain(JUnitCore.java: 72)
at org.junit.runner.JUnitCore.main(JUnitCore.java:44)

I have a file ServiceTest.class, but it's giving this error...

 
Reply With Quote
 
eggie5
Guest
Posts: n/a
 
      10-09-2007
On Oct 8, 4:49 pm, Manish Pandit <(E-Mail Removed)> wrote:
> On Oct 8, 4:40 pm, eggie5 <(E-Mail Removed)> wrote:
>
>
>
> > the junit jar is in /usr/local/src/junit4.4/- Hide quoted text -

>
> > - Show quoted text -

>
> The samples are not in junit-4.4.jar. They are in the Junit
> installation folder. Try adding the installation folder to classpath
> and see if it works..
>
> -cheers,
> Manish


If I run the example from the junit site, I get this:
/usr/local/src/junit4.4/junit/samples eggie5$ java
org.junit.runner.JUnitCore.runClasses(SimpleTest.c lass);
-bash: syntax error near unexpected token `('

 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
state of an object in setUp() of junit TestCase jimgardener Java 34 11-18-2010 03:08 AM
Need help designing some JUnit tests Rhino Java 47 05-30-2010 04:10 PM
help installing JUnit twistadias Java 0 12-03-2009 07:01 AM
help! throw SIGSEGV signal while open shared object from Tomcatserver, But success in JUnit lei.bobby@gmail.com C++ 1 12-20-2007 12:00 PM
JUNIT testSuite .. need to print all errors to file .. HELP. chrono Java 1 04-27-2005 02:45 AM



Advertisments