• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

One junit3.8.1 self-test failing

 
Greenhorn
Posts: 25
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi, J-newb here, long-time programmer in other languages, just spinning up on junit.

I've installed and tested junit as spec'd in its readme, like this:


I get the following error:


(I omitted this step from the read-me instructions:...because the cmd prompt is running from the junit3.8.1 dir, so it's effectively in the classpath already. Right? In any case, doing that first makes no difference to the test result.)

Thanks very much for any help.
 
Ranch Hand
Posts: 704
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Your installation is fine to prove it to yourself just run.

There is an error in the sample class TestCaseClassLoaderTest
 
Dave Merrill
Greenhorn
Posts: 25
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Originally posted by Nigel Browne:
There is an error in the sample class TestCaseClassLoaderTest


Thanks Nigel. It's ironic that junit gets release with a bug in its test cases. Newb that I am, it's good to get confirmation.

Couple things:
  • I posted this on the junit yahoo list, and a fellow replied that it passes all tests for him. Same java and junit versions I have, only difference I know of is he's on NT, I'm on win2k, which I wouldn't think would matter.
  • I looked at TestCaseClassLoaderTest.java, but I'm afraid I don't understand it at all. Could you explain a bit about what the bug is? I know I don't need to understand to use junit, but everything I get is good.
  • Seems like this should be reported at sourceforge as a bug. I don't mind doing that, but someone with more experience could probably submit a more specific report. Anyone want to take that on, or should I just go ahead myself?

  •  
    drifter
    Posts: 1364
    • Mark post as helpful
    • send pies
      Number of slices to send:
      Optional 'thank-you' note:
    • Quote
    • Report post to moderator
    It worked fine for me.


    C:\_tools\junit3.8.1>set classpath=C:\_tools\junit3.8.1;C:\_tools\junit3.8.1\junit.jar

    C:\_tools\junit3.8.1>java junit.textui.TestRunner junit.samples.AllTests
    .........................................
    .........................................
    .....................................
    Time: 1.552

    OK (119 tests)


    Or I can just run the one test you had fail:

    C:\_tools\junit3.8.1>java junit.textui.TestRunner junit.tests.runner.TestCaseClassLoaderTest
    ..
    Time: 0.04

    OK (2 tests)
     
    Ranch Hand
    Posts: 1282
    • Mark post as helpful
    • send pies
      Number of slices to send:
      Optional 'thank-you' note:
    • Quote
    • Report post to moderator
    works fine with me, too:


    i'v winXP sp2
    [ April 22, 2005: Message edited by: miguel lisboa ]
     
    Dave Merrill
    Greenhorn
    Posts: 25
    • Mark post as helpful
    • send pies
      Number of slices to send:
      Optional 'thank-you' note:
    • Quote
    • Report post to moderator
    Arrgghh.

    I downloaded junit again, restarted computer. No difference, same error.

    Is there anyone out there who could try this on win2k? Not that that should make any difference, but I don't know what else to do.

    Any other ideas?
     
    author and iconoclast
    Posts: 24207
    46
    Mac OS X Eclipse IDE Chrome
    • Mark post as helpful
    • send pies
      Number of slices to send:
      Optional 'thank-you' note:
    • Quote
    • Report post to moderator
    Note that unless you've specifically put "." (dot) into the classpath, the current directory won't be included, so that step you skipped may be the crucial one.
     
    miguel lisboa
    Ranch Hand
    Posts: 1282
    • Mark post as helpful
    • send pies
      Number of slices to send:
      Optional 'thank-you' note:
    • Quote
    • Report post to moderator
    just a guess

    try isolating the problem:
    comment the offending class and then rerun allTests
    run the problematic class alone

    maybe you'll get a hint from there...
     
    Dave Merrill
    Greenhorn
    Posts: 25
    • Mark post as helpful
    • send pies
      Number of slices to send:
      Optional 'thank-you' note:
    • Quote
    • Report post to moderator

    Originally posted by Ernest Friedman-Hill:
    Note that unless you've specifically put "." (dot) into the classpath, the current directory won't be included, so that step you skipped may be the crucial one.


    "." is in the system classpath.
     
    Carol Enderlin
    drifter
    Posts: 1364
    • Mark post as helpful
    • send pies
      Number of slices to send:
      Optional 'thank-you' note:
    • Quote
    • Report post to moderator
    It's not your typical ClassNotFoundException. It's trying to load junit.tests.runner.LoadedFromJar from test.jar.

    From the original error, see line 33 (TestCaseClassLoaderTest.java:33), I marked it in the code snippet:

    at junit.tests.runner.TestCaseClassLoaderTest.testJarClassLoading
    (TestCaseClassLoaderTest.java:33)


    [ April 22, 2005: Message edited by: Carol Enderlin ]
     
    Dave Merrill
    Greenhorn
    Posts: 25
    • Mark post as helpful
    • send pies
      Number of slices to send:
      Optional 'thank-you' note:
    • Quote
    • Report post to moderator

    Originally posted by miguel lisboa:
    try isolating the problem:
    comment the offending class and then rerun allTests
    run the problematic class alone


    The problem test is:
    runner.TestCaseClassLoaderTest.testJarClassLoading()

    The code for it is:
    I'm sure this technique is clunkier than some alternatives I'm not aware of (clue me, please!), but by working backwards from the end and commenting out one line at a time, this line is the first one to cause the error:
    However, the whole thing runs ok if I remove the path parameter to the line before that, so it matches the call in the TestCaseClassLoaderTest method of this same class.

    I don't understand what's going on here well enough to know what this means. Is there something the matter with the value being passed as the path? Why might that be, and why on my system and not others? If not that, what else? Without the path parameter, does it still test what it's supposed to?

    Thanks again for your help and patience as I get spun up here...
     
    miguel lisboa
    Ranch Hand
    Posts: 1282
    • Mark post as helpful
    • send pies
      Number of slices to send:
      Optional 'thank-you' note:
    • Quote
    • Report post to moderator
    i just deleted test.jar from junit3.8.1\junit\tests\runner dir and see what happened:
     
    Dave Merrill
    Greenhorn
    Posts: 25
    • Mark post as helpful
    • send pies
      Number of slices to send:
      Optional 'thank-you' note:
    • Quote
    • Report post to moderator

    Originally posted by miguel lisboa:
    i just deleted test.jar from junit3.8.1\junit\tests\runner dir and see what happened:[snip]]



    Sorry, I don't see what you're getting at. There's little similarity to the results, other than that there's one problem in each of them.

    You're getting a *failure*, "AssertionFailedError: Cannot find test.jar".
    I'm getting a "ClassNotFoundException: junit.tests.runner.LoadedFromJar" *error*.

    Can you be more explicit?
     
    miguel lisboa
    Ranch Hand
    Posts: 1282
    • Mark post as helpful
    • send pies
      Number of slices to send:
      Optional 'thank-you' note:
    • Quote
    • Report post to moderator
    i'd love to solve your prob

    the little similarity i see lies in the fact that both cases relate to that jar...
     
    With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
    reply
      Bookmark Topic Watch Topic
    • New Topic