Error using test framework

I'm trying to use the test framework but i'm getting an error that's preventing me from using it sucesfully.

I've implemented test case that extends PsiTestCase but this error happens if i extend any other Idea base test case classes.

So, what happens is that when i run the test(even an empty one) i get an error saying that it can't find some plugins class. If i add that plugin to my module classpath then it complaints that it can't find some other plugin class, and so on. I've actually haven't tried adding all plugins to the classpath to see if it works.

The actual error is:

Extension implementation class not found: org.jetbrains.idea.devkit.run.JUnitDevKitPatcher
ERROR:
com.intellij.diagnostic.PluginException: org.intellij.images.options.OptionsManager
at com.intellij.openapi.components.impl.ComponentManagerImpl.loadComponentsConfiguration(ComponentManagerImpl.java:59)
at com.intellij.openapi.application.impl.ApplicationImpl.c(ApplicationImpl.java:24)
at com.intellij.openapi.application.impl.ApplicationImpl.(ApplicationImpl.java:267) at com.intellij.openapi.application.ex.ApplicationManagerEx.createApplication(ApplicationManagerEx.java:2) at com.intellij.idea.CommandLineApplication.(CommandLineApplication.java:17) at com.intellij.idea.CommandLineApplication.(CommandLineApplication.java:8) at com.intellij.idea.IdeaTestApplication.(IdeaTestApplication.java:5) at com.intellij.idea.IdeaTestApplication.getInstance(IdeaTestApplication.java:7) at com.intellij.testFramework.IdeaTestCase.initApplication(IdeaTestCase.java:138) at com.intellij.testFramework.IdeaTestCase.setUp(IdeaTestCase.java:189) at com.intellij.testFramework.ModuleTestCase.setUp(ModuleTestCase.java:39) at com.intellij.testFramework.PsiTestCase.setUp(PsiTestCase.java:34) at com.intellij.testFramework.IdeaTestCase$5.run(IdeaTestCase.java:2) at java.awt.event.InvocationEvent.dispatch(InvocationEvent.java:199) at java.awt.EventQueue.dispatchEvent(EventQueue.java:461) at java.awt.EventDispatchThread.pumpOneEventForHierarchy(EventDispatchThread.java:242) at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:163) at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:157) at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:149) at java.awt.EventDispatchThread.run(EventDispatchThread.java:110) Caused by: java.lang.ClassNotFoundException: org.intellij.images.options.OptionsManager at java.net.URLClassLoader$1.run(URLClassLoader.java:200) at java.security.AccessController.doPrivileged(Native Method) at java.net.URLClassLoader.findClass(URLClassLoader.java:188) at java.lang.ClassLoader.loadClass(ClassLoader.java:306) at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:268) at java.lang.ClassLoader.loadClass(ClassLoader.java:251) at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:319) at java.lang.Class.forName0(Native Method) at java.lang.Class.forName(Class.java:242) at com.intellij.openapi.components.impl.ComponentManagerImpl.loadComponentsConfiguration(ComponentManagerImpl.java:145) ... 19 more java.lang.AssertionError: at com.intellij.testFramework.LoggedErrorProcessor$1.processError(LoggedErrorProcessor.java:9) at com.intellij.testFramework.TestLogger.error(TestLogger.java:9) at com.intellij.openapi.diagnostic.Logger.error(Logger.java:59) at com.intellij.openapi.components.impl.ComponentManagerImpl.loadComponentsConfiguration(ComponentManagerImpl.java:59) at com.intellij.openapi.application.impl.ApplicationImpl.c(ApplicationImpl.java:24) at com.intellij.openapi.application.impl.ApplicationImpl.(ApplicationImpl.java:267) at com.intellij.openapi.application.ex.ApplicationManagerEx.createApplication(ApplicationManagerEx.java:2) at com.intellij.idea.CommandLineApplication.(CommandLineApplication.java:17) at com.intellij.idea.CommandLineApplication.(CommandLineApplication.java:8) at com.intellij.idea.IdeaTestApplication.]]>(IdeaTestApplication.java:5)
at com.intellij.idea.IdeaTestApplication.getInstance(IdeaTestApplication.java:7)
at com.intellij.testFramework.IdeaTestCase.initApplication(IdeaTestCase.java:138)
at com.intellij.testFramework.IdeaTestCase.setUp(IdeaTestCase.java:189)
at com.intellij.testFramework.ModuleTestCase.setUp(ModuleTestCase.java:39)
at com.intellij.testFramework.PsiTestCase.setUp(PsiTestCase.java:34)
at com.intellij.testFramework.IdeaTestCase$5.run(IdeaTestCase.java:2)
at java.awt.event.InvocationEvent.dispatch(InvocationEvent.java:199)
at java.awt.EventQueue.dispatchEvent(EventQueue.java:461)
at java.awt.EventDispatchThread.pumpOneEventForHierarchy(EventDispatchThread.java:242)
at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:163)
at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:157)
at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:149)
at java.awt.EventDispatchThread.run(EventDispatchThread.java:110)
at java.awt.EventDispatchThread.run(EventDispatchThread.java:110)

7 comments

Hello Hugo,

Indeed, using IDEA's test framework is tricky. We're planning to make it
simpler.
Until then it makes sence reading what Kirill Maximov once wrote about:
http://kirblog.idetalk.com/2005/09/writing-unit-tests-for-intellij-idea.html

-


Maxim Shafirov
JetBrains, Inc
http://www.jetbrains.com
"Develop with pleasure!"


0

Your right, it is tricky. Is the simplification only going to happen for the next version or is it going to happen in the 5.x version ?

0

Hello Hugo,

Only in 6.0, sorry.

-


Maxim Shafirov
JetBrains, Inc
http://www.jetbrains.com
"Develop with pleasure!"


0

I got the tests to run on IDEA. The problem now is running the same tests using maven2.

The approach i'm using is to extend ModuleTestCase and in the setup use the loadModule method to load a module i created just for testing. This way, i think, i should be able to run the tests from outside IDEA.

When i run the tests i'm getting the following exception:

ERROR: Assertion failed: Defaults not found:componentSets/IdeaComponents
java.lang.Throwable
at com.intellij.openapi.diagnostic.Logger.assertTrue(Logger.java:78)
at com.intellij.openapi.components.impl.ComponentManagerImpl.a(ComponentManagerImpl.java:64)
at com.intellij.openapi.components.impl.ComponentManagerImpl.a(ComponentManagerImpl.java:17)
at com.intellij.openapi.components.impl.ComponentManagerImpl.loadComponentsConfiguration(ComponentManagerImpl.java:39)
at com.intellij.openapi.application.impl.ApplicationImpl.c(ApplicationImpl.java:381)
at com.intellij.openapi.application.impl.ApplicationImpl.(ApplicationImpl.java:418) at com.intellij.openapi.application.ex.ApplicationManagerEx.createApplication(ApplicationManagerEx.java:6) at com.intellij.idea.CommandLineApplication.(CommandLineApplication.java:11) at com.intellij.idea.CommandLineApplication.(CommandLineApplication.java:16) at com.intellij.idea.IdeaTestApplication.]]>(IdeaTestApplication.java:8)
at com.intellij.idea.IdeaTestApplication.getInstance(IdeaTestApplication.java:7)
at com.intellij.testFramework.IdeaTestCase.initApplication(IdeaTestCase.java:102)
at com.intellij.testFramework.IdeaTestCase.setUp(IdeaTestCase.java:190)
at com.intellij.testFramework.ModuleTestCase.setUp(ModuleTestCase.java:40)
at org.intellij.tapestry.AbstractModuleTestCase.setUp(AbstractModuleTestCase.java:44)
at com.intellij.testFramework.IdeaTestCase$4.run(IdeaTestCase.java:21)
at java.awt.event.InvocationEvent.dispatch(InvocationEvent.java:199)
at java.awt.EventQueue.dispatchEvent(EventQueue.java:461)
at java.awt.EventDispatchThread.pumpOneEventForHierarchy(EventDispatchThread.java:242)
at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:163)
at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:157)
at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:149)
at java.awt.EventDispatchThread.run(EventDispatchThread.java:110)


-



java.lang.AssertionError: Assertion failed: Defaults not found:componentSets/IdeaComponents
at com.intellij.testFramework.LoggedErrorProcessor$1.processError(LoggedErrorProcessor.java:4)
at com.intellij.testFramework.TestLogger.error(TestLogger.java:14)
at com.intellij.openapi.diagnostic.Logger.error(Logger.java:55)
at com.intellij.openapi.diagnostic.Logger.assertTrue(Logger.java:78)
at com.intellij.openapi.components.impl.ComponentManagerImpl.a(ComponentManagerImpl.java:64)
at com.intellij.openapi.components.impl.ComponentManagerImpl.a(ComponentManagerImpl.java:17)
at com.intellij.openapi.components.impl.ComponentManagerImpl.loadComponentsConfiguration(ComponentManagerImpl.java:39)
at com.intellij.openapi.application.impl.ApplicationImpl.c(ApplicationImpl.java:381)
at com.intellij.openapi.application.impl.ApplicationImpl.(ApplicationImpl.java:418) at com.intellij.openapi.application.ex.ApplicationManagerEx.createApplication(ApplicationManagerEx.java:6) at com.intellij.idea.CommandLineApplication.(CommandLineApplication.java:11) at com.intellij.idea.CommandLineApplication.(CommandLineApplication.java:16) at com.intellij.idea.IdeaTestApplication.]]>(IdeaTestApplication.java:8)
at com.intellij.idea.IdeaTestApplication.getInstance(IdeaTestApplication.java:7)
at com.intellij.testFramework.IdeaTestCase.initApplication(IdeaTestCase.java:102)
at com.intellij.testFramework.IdeaTestCase.setUp(IdeaTestCase.java:190)
at com.intellij.testFramework.ModuleTestCase.setUp(ModuleTestCase.java:40)
at org.intellij.tapestry.AbstractModuleTestCase.setUp(AbstractModuleTestCase.java:44)
at com.intellij.testFramework.IdeaTestCase$4.run(IdeaTestCase.java:21)
at java.awt.event.InvocationEvent.dispatch(InvocationEvent.java:199)
at java.awt.EventQueue.dispatchEvent(EventQueue.java:461)
at java.awt.EventDispatchThread.pumpOneEventForHierarchy(EventDispatchThread.java:242)
at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:163)
at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:157)
at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:149)
at java.awt.EventDispatchThread.run(EventDispatchThread.java:110)


Any idea of what it might be ? Problably a missing jar, but i can't figure out which one.

0

The test runs but i'm not getting the behaviour i'd like.

What i want is to create a web module only for tests, with some java code and some web pages. I want to run all my tests with this module. I tried to implement this extending ModuleTestCase and using the loadModule method to get my test module. The problem is that is seems that the module is not getting fully loaded. The loadModule return the Module instance, i can get it's name and all that. But if i try for example to access the J2EEModuleProperties of the module everything returns null, i can see no J2EEModuleProperties. The same goes to finding classes, i can't find any classes in the module.

Any ideas ?

0

Hi Hugo,

After our private conversation I've finally made a post with example of unit test which loads IDEA's project stored on disk:

http://kirblog.idetalk.com/2006/02/unit-test-for-intellij-idea-plugin.html

Regards,
KIR

0

Just wondering, is there a public API for this now ?

0

Please sign in to leave a comment.