Marko Zadravec
Marko Zadravec

Reputation: 8730

Eclipse Scout client unit tests

I am trying to create some unit test for scout client elements.

I have template for AbstractGroupBox, let say AbstractMyBox.

I see that I need to have ScoutClientTestRunner for this, so I create simple example :

@RunWith(ScoutClientTestRunner.class)
public class MyyBoxTemplateTest {

  AbstractMyBox box;

  @Before
  public void createTemplate() throws Exception {

    box = new AbstractMyBox() {};
  }


  @After
  public void destroyTemplate() throws Exception {

    box = null;
  }

  @Test
  public void testTitle() {

    String title = box.getLabel();
    assertEquals(title, TEXTS.get("Something"));
  }
}

When I run Unit test with JUnit Plug-in test it open new eclipse window

enter image description here

and clock is spinning, inside JUnit component it said Runs: 0/0

What am I doing wrong?

Marko

Upvotes: 1

Views: 100

Answers (2)

Jmini
Jmini

Reputation: 9497

Your problem has nothing to do with Eclipse Scout. The following applies for every Eclipse bundle project (using Plug-in Development Environment (PDE) in your Eclipse IDE).

When your run a Test using “Run as > JUnit Plug-in Test”, all plug-ins in your workspace are started.

Run as > JUnit Plug-in Test

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

Run Configurations

To reduce the set of started plug-ins, you should do the following:

  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 should be opened.

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).

Upvotes: 1

Marko Zadravec
Marko Zadravec

Reputation: 8730

I have wrong run-configuration settings.

Under Run-Configuration / Main / Program to Run I need to set Run an Application : [No Application] - Headless Mode

Upvotes: 0

Related Questions