Skip to main content



      Home
Home » Eclipse Projects » Eclipse Scout » [neon] Supplying a desktop when unit testing forms
[neon] Supplying a desktop when unit testing forms [message #1755055] Mon, 27 February 2017 11:07 Go to next message
Eclipse UserFriend
We're looking at migrating all our scout unit tests which in Mars used to be in the test fragments and can now be moved into src/test/java.

I had a look at Jérémie's presentation: https://wiki.eclipse.org/images/f/fa/2016-10-24_EclipseScoutNeonTesting.pdf

I've come across a point which is not mentioned in the presentation, it's probably a simple issue but I can't find a solution.

I have a class I want to test:

public class UserMeldungForm extends AbstractForm {
  // snip various interna
  public UserMeldungForm(String nlsKey, List<NlsParameterEntry> params, String titel, String icon) throws ProcessingException {
    this.titel = titel;
    this.nlsKey = nlsKey;
    this.paramList = params;
    this.icon = icon;
    startInternal(new ShowHandler());
  }
  // snip more interna
}


My UnitTest looks like this:
@RunWith(ClientTestRunner.class)
@RunWithClientSession(CoreClientSession.class)
@RunWithSubject("testSubject")
public class FehlerMeldungFormTest {
  @Test
  public void testShowInformationMeldungString() throws ProcessingException {
    final UserMeldungForm form = new UserMeldungForm("CO_ERROR", null, "FooBar", CoreIcons.STATUS_INFO);
    assertEquals("Gugus", form.getTitle());
  }
}


When I run this unit test, it results in an error on the line where startInternal() is called in the constructor.

org.eclipse.scout.rt.platform.exception.ProcessingException: There is no desktop or it is not open in the UI. [severity=ERROR, user=testSubject]

How do I supply a desktop to client unit tests that want to instantiate AbstractForms?
Re: [neon] Supplying a desktop when unit testing forms [message #1755898 is a reply to message #1755055] Thu, 09 March 2017 03:07 Go to previous message
Eclipse UserFriend
Hi Urs. Have your tried to use the org.eclipse.scout.rt.client.testenvironment.TestEnvironmentClientSession instead of your CoreClientSession in @RunWithClientSession? That's the class we use in our own unit tests.
Previous Topic:[NEON] Hot Swapping UI changes made in Java
Next Topic:Scout Jasperreports integration
Goto Forum:
  


Current Time: Wed Jun 18 02:55:48 EDT 2025

Powered by FUDForum. Page generated in 0.06059 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top