History | Log In     View a printable version of the current page.  
Issue Details (XML | Word | Printable)

Key: IDEA-16108
Type: Bug Bug
Status: Waiting for Reply Waiting for Reply
Assignee: Dmitry Jemerov
Reporter: Keith Lea
Votes: 0
Watchers: 0
Operations

If you were logged in you would be able to see more operations.
IDEA: Feedback

Regression: cannot create run configuration from an IdeaTestCase

Created: 31 Oct 07 03:41   Updated: 03 Nov 07 02:48
Component/s: Unit Testing. JUnit

Environment: Ubuntu Linux

Build: 7,523
Severity: High


 Description  « Hide
The test below passes in IntelliJ 6 (6.0.5). The code appears to work inside the plugin itself - just not in tests. Are the run configuration types limited during unit tests?

If you can't fix this exact test (I understand it depends on non-openapi) is there another way I could test this? Specifically we want to ensure that upon creating a new application or junit run configuration, the working directory is set correctly.

import com.intellij.testFramework.IdeaTestCase;
import com.intellij.execution.impl.RunManagerImpl;
import com.intellij.execution.RunManager;
import com.intellij.execution.configurations.ConfigurationFactory;

public class TestRunConfigurationCreation extends IdeaTestCase {
  public void testJunit() {
    checkRunConfigurationCreation("JUnit");
  }

  public void testApplication() {
    checkRunConfigurationCreation("Application");
  }

  private void checkRunConfigurationCreation(String type) {
    RunManagerImpl runManager = (RunManagerImpl)RunManager.getInstance(myProject);
    ConfigurationFactory factory = runManager.getFactory(type, null);
    assertNotNull(factory);
    runManager.createRunConfiguration("test", factory);
  }
}


 All   Comments   Work Log   Change History      Sort Order:
Dmitry Jemerov - 01 Nov 07 19:26
Looks like you're running the test with all plugins disabled. JUnit is now a plugin, so you need to leave it enabled via idea.load.plugins.id if you need to test JUnit related features.

Keith Lea - 01 Nov 07 20:51
Is there a way to load the plugin from the test, or does it need to be part of the run configuration? I'd much prefer if the tests didn't depend on special command line arguments.

Dmitry Jemerov - 02 Nov 07 15:42
You can use System.setProperty() to set that property from the code of your unit test.

Keith Lea - 03 Nov 07 02:48
I tried calling System.setProperty("idea.load.plugins.id", "JUnit"); in a static initializer and before the super.setUp() call. Neither seems to change anything.