• 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

Named TestSuite gives error in JUnit_4.1 used w/Eclipse

 
Greenhorn
Posts: 10
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi All,
I created a TestSuite using the Eclipse wizard and JUnit4_4.1. Works fine with the default name "AllTests". But if change the name to something else, gives error - "java.lang.Exception: No runnable methods".
If I use JUnit_3.8.1 and Eclipse; everything works fine even if I can change the name of the TestSuite. Looks like something to do with JUnit4_4.1 version. The jar file is called junit-4.1.jar and Eclipse version is 3.2.0

Below are the error traces and the code used. Please advise-

Test


TestSuite


Error Message and Trace

 
author
Posts: 14112
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Eclipse has two different runners for JUnit 3 and JUnit 4 tests. Your test suite is JUnit 3 - style (see http://radio.javaranch.com/lasse/2006/07/27/1154024535662.html for how to do it JUnit 4 - style).

When you run the test from Eclipse, make sure that the launch configuration is configured for the correct version of JUnit. If you don't, you will get exactly the error message you got.

I think there is also a global setting for what Eclipse will use as default.
 
Rick Shroff
Greenhorn
Posts: 10
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Hi Ilja,



Eclipse has two different runners for JUnit 3 and JUnit 4 tests. Your test suite is JUnit 3 - style (see http://radio.javaranch.com/lasse/2006/07/27/1154024535662.html for how to do it JUnit 4 - style).


I went to the above link ans was able to successfully run the TestSuite. Thanks a lot. I think this URL link is one of the very rare places where this is documented.




When you run the test from Eclipse, make sure that the launch configuration is configured for the correct version of JUnit. If you don't, you will get exactly the error message you got.

I think there is also a global setting for what Eclipse will use as default


For changing Launch Configuration, I navigated to Windows--->Preferences --->Launcing --> Launch Configurations. But did not change anything. Did not know how to do it.

Any way it seems to be picking up the JUnit version correctly from the Libraries specified in the JavaBuild Path.

Thanks Again!!

 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
reply
    Bookmark Topic Watch Topic
  • New Topic