4

When I started JUnit Plug-in Test, I always have eclipse GUI launched. Can I change the setup to prevent this?

I'm testing eclipse plugin - Difference between `JUnit Plug-in Test` and `JUnit Test` in eclipse

enter image description here

enter image description here

Community
  • 1
  • 1
prosseek
  • 182,215
  • 215
  • 566
  • 871

2 Answers2

5

Are you developing Eclipse plugins (or an RCP application)?

No: You don't want to run a "JUnit Plugin test". Always run your tests as "Junit test".

Yes: On the "Main" tab of your Junit Plugin test launch configuration, select the radio button "Run an application" and choose the application "No application - Headless Mode".

Bananeweizen
  • 21,797
  • 8
  • 68
  • 88
  • 1
    I got 'Workspace is closed error' when I run "Junit test". Could you check http://stackoverflow.com/questions/13894287/difference-between-junit-plug-in-test-and-junit-test-in-eclipse and http://stackoverflow.com/questions/13889273/debugging-eclipse-unit-test-code-test-class-should-have-exactly-one-and-works ? – prosseek Dec 16 '12 at 14:52
  • 1
    Then you are developing a plugin (or RCP application) and have to choose "Yes" in my answer. – Bananeweizen Dec 16 '12 at 16:32
  • Well, I just tried to launch JUnit test for refactoring plugins for eclipse. – prosseek Dec 16 '12 at 18:22
1

In my opinion this is a problem of the Plug-in Development Environment (PDE) tooling of the Eclipse IDE. When you select “Run as > JUnit Plug-in Test”, Eclipse is starting all plug-ins in your workspace to run the tests.

Run as > JUnit Plug-in Test

You can check this by opening the corresponding “Run Configuration”

Run Configurations

I do not know your exact set-up, but I guess that you do not need all the plugins when you run a unit test. Here is how I do it:

  1. Switch to “plug-ins selected bellow only”
  2. Click on “Delesect All”
  3. Select the Bundle where your test are located (org.eclipsescout.demo.minifigcreator.client.test in my case)
  4. Click on “Add required Plug-ins”
  5. [optional] click on “Validate Plug-ins” (expected message: “No problems were detected”)
  6. Click on “Run”

Run Configurations - correct set of plug-ins

Your test should now run, and no second eclipse workbench (Eclipse GUI) should be opened (unless you have a direct dependency to it).

Depending on your setup (workspace, team, source control...), it might be usefull to save this as launcher file and to share it with your team (see the options in the “Commons” tab).

Jmini
  • 9,189
  • 2
  • 55
  • 77