Why does my LightPlatformTestCase have problems loading plugins

I'm playing around with a plugin and named extensions points

I have a pretty simple test that extends LightPlatformTestCase, and I'm trying to run it using the "Right Click"->"run NamedExtensionTestCase" which creates a run configuration with the settings :

Test Kind : Class
Class : com.example.plugin.NamedExtensionTestCase
VM options : -ea
Program arguments :
Working directory : $MODULE_DIR$
Env Vars :
Use classpath of : test-plugin
Use alternatvie JRE : (NO)

here's the test

<code> (? is there a forum code tag)
public class NamedExtensionTestCase extends LightPlatformTestCase {

  public NamedExtensionTestCase() {

  public void testGetService() {
    MyExtension ext = MyExtension.getInstance("default"); // this just uses a keyedExtensionCollector to get the ext

    assertInstanceOf(proxy, DefaultMyExtension.class);

When I try to run this test : I get a set of errors reated to plugins not loading :
ERROR: Problems found loading plugins:
<br>Plugin "Groovy" was not loaded: required plugin "com.intellij.properties" not installed ...more missing plugins..... <a href="disable">Disable not loaded plugins</a><br><a href="edit">Open plugin manager</a>
 at com.intellij.openapi.diagnostic.Logger.error(Logger.java:115)
 at com.intellij.ide.plugins.PluginManagerCore.prepareLoadingPluginsErrorMessage(PluginManagerCore.java:488)
 at com.intellij.ide.plugins.PluginManagerCore.initializePlugins(PluginManagerCore.java:1162)

Comment actions Permalink

The error happens because the classpath you're using to run your tests includes the Groovy plugin but not other plugins that it depends on. You'll need to add the missing plugins to the classpath of your IntelliJ IDEA SDK.

Comment actions Permalink

So including dependent plugins via global libraries on the plugin classpath wont work here?

As described here (faily old docs) :

In this case, it feels like the development workflow and test workflow are not aligned.  Or should I not be including plugin dependencies via the global libraries?

Comment actions Permalink

The workflow is the same for development and tests. You can either add the plugin jars as libraries with provided scope, or add them to the classpath of the IntelliJ IDEA SDK.

Comment actions Permalink

Hi Appu,


Did you manage to resolve this issue?

I've got similar problems when trying to run this particular unit test in my plugin project:

It's complaining about the i18n plugin which is a (provided) dependency of my own plugin. Everything is working fine at run time, but it seems it is using another classpath for the unit test, where it can't find the i18n jar :(

Comment actions Permalink

Specifically, in Gradle to fix this I had to add properties to the plugins key in my build.gradle:

intellij { 
plugins = [ ... , 'properties']

Please sign in to leave a comment.