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?