Posted by Vikas Hazrati on Monday, June 9, 2008

If you are getting the above error message in Eclipse IDE, while running your test case, just make sure that you have the test class as a part of the “eclipse source folder” definition.
Easiest way. Right click on the folder –> Build Path –>Use as source folder
Done.
This entry was posted on Monday, June 9, 2008 at 2:57 pm and is filed under Java, testing.
You can follow any responses to this entry through the RSS 2.0 feed.
You can leave a response, or trackback from your own site.
gerry said
Hi,
Which folder are you referring to?
Thanks
Gerry
vikashazrati said
Hi Gerry,
Right click on the folder in which you have the test class. Best way to do this is open the test class and then right click on the test class and hit ‘Show in–> Package Explorer’, this would take you to the folder where the test class is.
Regards | Vikas
Blayne said
Found you via google when I ran into this problem. Applied the fix, worked perfectly first time…just wanted to say thanks for saving me a lot of headache!
vikashazrati said
Thanks Blayne
Richa said
Found this via Google. Worked first time! Thanks!!
Dan said
Likewise, found on Google, worked first time – thanks !
Simon said
found it via google,too
thank you very much
cheers
Graham said
I am using Eclipse Ganymede and am getting this message but the fix doesn’t work.
It will run a test case created under Europa, but not one created under Ganymede.
If I try it with Eclipse Europa – no problem, it runs both test cases.
Frustrating. For now I’ll revert to Europa.
Ghent said
I have the same problem with Ganymede, the fix doesn’t work.
sid said
Exactly what I needed to know – thanks!
Amzad Basha said
After making a right-click on test folder and applying “Build Path –> Use as source folder”, it needs to clean the project (Project -> clean) and then refresh it (right-click and choose ‘Refresh’). This will solve the problem.
matt said
thanks for the clean tip. In my case, I had manually tweaked the .classpath and forgot to do a clean rebuild…. oh and it also helps to check the stupid stuff, like is your server running for remote cactus and delegate testing?
Chuck said
This is awesome, definitely helped me out! Thanks!
anthony said
merci, ça marche nickel !!!
Radsa said
Worked perfect. Thanks for the tip
John said
Excellent tip. I had a strange case where the folder was already on the build path, but its subfolders had sort of ghosted icons. I ran “Build Path -> Remove From Build Path”, then reran your instructions and it fixed it right up. Thanks!
anonymous said
This is extremely helpful. Thanks.
Stephane said
No, the trick doesn’t help at all on version Ganymede 3.4.0.
I also did the clean and refresh but it didn’t help.
Only a restart of Eclipse stopped the popup message to show up.
But my test is now simply not run at all, like if it was not a test.
Still I have the contextual menu item to run it as a Junit test.