JUnit Plugin Can't Find Test Classes

Ok, I'm totally baffled by this. I'm using IDEA 4.0 build 1167 and when I try and run my tests, it says ClassNotFound. Here's the output from JRunner:

C:/j2sdk1.4.2_03\bin\java -Dfile.encoding=windows-1252 -classpath C:\j2sdk1.4.2_03\jre\lib\charsets.jar;C:\j2sdk1.4.2_03\jre\lib\jce.jar;C:\j2sdk1.4.2_03\jre\lib\jsse.jar;C:\j2sdk1.4.2_03\jre\lib\plugin.jar;C:\j2sdk1.4.2_03\jre\lib\rt.jar;C:\j2sdk1.4.2_03\jre\lib\sunrsasign.jar;C:\j2sdk1.4.2_03\jre\lib\ext\dnsns.jar;C:\j2sdk1.4.2_03\jre\lib\ext\ldapsec.jar;C:\j2sdk1.4.2_03\jre\lib\ext\localedata.jar;C:\j2sdk1.4.2_03\jre\lib\ext\sunjce_provider.jar;C:\MyStuff\Projects\Tutorials\HTTPUnit\server\classes;C:\httpunit-1.5.4\lib\httpunit.jar;C:\junit3.8.1\junit.jar;C:\IntelliJ-IDEA-4.0\lib\idea_rt.jar;C:\IntelliJ-IDEA-4.0\lib\idea_rt.jar -Didea.launcher.port=7540 -Didea.launcher.library=C:\IntelliJ-IDEA-4.0\bin\breakgen.dll com.intellij.rt.execution.application.AppMain com.intellij.rt.execution.junit2.JUnitStarter -ideVersion5 tutorial.PoolEditorTest
Class not found "tutorial.PoolEditorTest"
Process terminated with exit code 1

You will notice that "C:\MyStuff\Projects\Tutorials\HTTPUnit\server\classes" is in the classpath. When I navigate to that directory and go to the "tutorial" subdirectory, there lies a brand new spankin' copy of PoolEditorTest.class.

So it's in the classpath. The file exists. I don't know what else to do.

I've searched through the Tracker database and didn't find anything on this. I can only assume that I'm doing something wrong. Any thoughts out there?

Michael

5 comments
Comment actions Permalink

I don't know about the details of your problem, but I am having trouble getting a simple unit test to work on build 2018.

I have two hierarchies: one for testing and one for the src code, as shown in the two attachments. When I try running the tests, even after compiling the code, the ide says it finds no test classes.

I tried collapsing the unit test into the main src hierarchy, but that did not help either.

I can run the tests directly without problem.



Attachment(s):
Picture 1.jpg
Picture 2.jpg
0
Comment actions Permalink

Michael Schaefer wrote:

Ok, I'm totally baffled by this. I'm using IDEA 4.0 build 1167 and when I try and run my tests, it says ClassNotFound. Here's the output from JRunner:

C:/j2sdk1.4.2_03\bin\java -Dfile.encoding=windows-1252 -classpath C:\j2sdk1.4.2_03\jre\lib\charsets.jar;C:\j2sdk1.4.2_03\jre\lib\jce.jar;C:\j2sdk1.4.2_03\jre\lib\jsse.jar;C:\j2sdk1.4.2_03\jre\lib\plugin.jar;C:\j2sdk1.4.2_03\jre\lib\rt.jar;C:\j2sdk1.4.2_03\jre\lib\sunrsasign.jar;C:\j2sdk1.4.2_03\jre\lib\ext\dnsns.jar;C:\j2sdk1.4.2_03\jre\lib\ext\ldapsec.jar;C:\j2sdk1.4.2_03\jre\lib\ext\localedata.jar;C:\j2sdk1.4.2_03\jre\lib\ext\sunjce_provider.jar;C:\MyStuff\Projects\Tutorials\HTTPUnit\server\classes;C:\httpunit-1.5.4\lib\httpunit.jar;C:\junit3.8.1\junit.jar;C:\IntelliJ-IDEA-4.0\lib\idea_rt.jar;C:\IntelliJ-IDEA-4.0\lib\idea_rt.jar -Didea.launcher.port=7540 -Didea.launcher.library=C:\IntelliJ-IDEA-4.0\bin\breakgen.dll com.intellij.rt.execution.application.AppMain com.intellij.rt.execution.junit2.JUnitStarter -ideVersion5 tutorial.PoolEditorTest
Class not found "tutorial.PoolEditorTest"
Process terminated with exit code 1

You will notice that "C:\MyStuff\Projects\Tutorials\HTTPUnit\server\classes" is in the classpath. When I navigate to that directory and go to the "tutorial" subdirectory, there lies a brand new spankin' copy of PoolEditorTest.class.

So it's in the classpath. The file exists. I don't know what else to do.

I've searched through the Tracker database and didn't find anything on this. I can only assume that I'm doing something wrong. Any thoughts out there?

Michael

Have you tried running it from command line? Have you tried a newer
version of IDEA (4.0.3 is official release of build 1182 or 1183, and
EAP is up to build 2018)? If you don't find an answer, you might want to
contact support.

--
Rob Harwood
Software Developer
JetBrains Inc.
http://www.jetbrains.com
"Develop with pleasure!"

0
Comment actions Permalink

I think I would have been better off not working today.

Just saw the obvious problem. I had extended the TestSuite class instead of the TestCase one!

Duh...

0
Comment actions Permalink

I found the solution to my own problem. I mistakenly thought that the version of junit wouldn't matter. So I had the 3.7 version of the JUnit jar in my classpath (duplicating what we have on our test servers). I found a thread on this forum insinuating that this causes major problems for IDEA. So I changed the reference from the 3.7 to the 3.8.1 version of the jar file and my "ClassNotFound" error went away.

Not good. Not good at all. I now have to customize my development environment locally so that it works with IDEA. Me no likey.


Mikey

0
Comment actions Permalink

Spoke too soon. Looks like it lets me run the tests from main(), but if I right click on the method name and select "Run 'testOnePlusOne()'" from the pop-up menu, I still get the "ClassNotFoundError". Anybody else getting this? I'd hate to open a problem ticket if it's just something stupid I'm doing on my end.

Michael

0

Please sign in to leave a comment.