4 Replies Latest reply: May 1, 2008 9:13 AM by 807591 RSS

    Newbie trying to run JUnit sample

    807591
      Hi All

      I'm learning java with a view to replacing ColdFusion with J2EE back ends for the Flex apps that I create.

      At the moment I am trying to create a JUnit test harness for my sample model class.

      I am trying to run the sample maths class that is included in the download.

      If I try this command:

      (please note I have most likely got the package name and syntax slightly wrong as I am doing this from memory as I am at work not home)

      java junit.samples.maths.TestAll

      I got an error as I had expected. I thin try:

      java -classpath ../junit-4.4.jar junit.samples.maths.testAll

      this time I get another unexpected result:

      NoClassDefFoundError

      I am getting the same problem in my very simple test class that at the moment is just a Hello World class that extends TestCase. it compiles fine (so it obviously found the TestCase class) but again can't run.

      What am I doing wrong? I appreciate that you might need more details but I can't give them just yet.

      Can I put the junit-4.4.jar somewhere within my JDK directory so that I don't need to add a classpath argument to compile / run?

      Sorry for the basic questions, I hope someone can help.

      Thanks

      Giles