Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    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 16:07 Go to next message
Urs Beeli is currently offline Urs BeeliFriend
Messages: 573
Registered: October 2012
Location: Bern, Switzerland
Senior Member
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 08:07 Go to previous message
Andre Wegmueller is currently offline Andre WegmuellerFriend
Messages: 204
Registered: September 2012
Location: Baden-Dättwil, Switzerla...
Senior Member
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.

Eclipse Scout Homepage | Documentation | GitHub
Previous Topic:[NEON] Hot Swapping UI changes made in Java
Next Topic:Scout Jasperreports integration
Goto Forum:
  


Current Time: Fri Apr 26 17:42:03 GMT 2024

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

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

Back to the top