| Author |
Named TestSuite gives error in JUnit_4.1 used w/Eclipse
|
Rick Shroff
Greenhorn
Joined: Mar 06, 2008
Posts: 10
|
|
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
|
Cheers,<br />Rick<br />SCJP
|
 |
Ilja Preuss
author
Sheriff
Joined: Jul 11, 2001
Posts: 14112
|
|
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.
|
The soul is dyed the color of its thoughts. Think only on those things that are in line with your principles and can bear the light of day. The content of your character is your choice. Day by day, what you do is who you become. Your integrity is your destiny - it is the light that guides your way. - Heraclitus
|
 |
Rick Shroff
Greenhorn
Joined: Mar 06, 2008
Posts: 10
|
|
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!!
|
 |
 |
|
|
subject: Named TestSuite gives error in JUnit_4.1 used w/Eclipse
|
|
|