1

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

Marko Zadravec
  • 8,298
  • 10
  • 55
  • 97
  • Just some comment about your code: in Java you do not need the 'destroyTemplate' method. Let the Garbage Collector do its job. – Jmini Mar 09 '15 at 15:22

2 Answers2

1

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

Jmini
  • 9,189
  • 2
  • 55
  • 77
  • I try your way, but then tests are not ran. I have to set [No Application] - Headless Mode and all plug-ins in order to be able to perform the tests – Marko Zadravec Mar 10 '15 at 08:38
0

I have wrong run-configuration settings.

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

Marko Zadravec
  • 8,298
  • 10
  • 55
  • 97
  • or if you start your test/test suite with the appropriate set of plug-ins you do not have any application. – Jmini Mar 09 '15 at 15:20