Eclipse Community Forums - RDF feed
https://www.eclipse.org/forums/
Eclipse Community ForumsNeed to run JUnit plug-in test with no GUI
https://www.eclipse.org/forums/index.php/mv/msg/1097860/1803474/#msg_1803474
I'm working on a JUnit plug-in test that loads a model (org.eclipse.uml2.uml.Model) to perform some operations.
To retrieve the model I use the following rules:
@Rule
public final PapyrusEditorFixture editor = new PapyrusEditorFixture();
@Test
@PluginResource("resources/xxx.di")
And in the method I use:
editor.getModel();
In the run configuration, I checked 'run a product: org.eclipse.platform.ide'.
The problem is that each time I run the test, the GUI of papyrus appears.
It there a way to perform a JUnit plug-in test that loads a model without the need to open the GUI of Papyrus?
In the run configuration, if I select 'run an application: Headless Mode', I get the following exception:
java.lang.IllegalStateException: Workbench has not been created yet.
Many thanks,
Alberto
]]>Alberto Debiasi2019-03-01T10:55:07-00:00Re: Need to run JUnit plug-in test with no GUI
https://www.eclipse.org/forums/index.php/mv/msg/1097860/1803477/#msg_1803477
There are other kinds of AbstractModelFixture that you can use in headless tests. Search for references to ModelSetFixture and ServiceRegistryModelSetFixture, in particular, for examples of their use.
HTH,
Christian ]]>Christian Damus2019-03-01T11:04:39-00:00Re: Need to run JUnit plug-in test with no GUI
https://www.eclipse.org/forums/index.php/mv/msg/1097860/1803478/#msg_1803478
It's not possible to run the "Papyrus Editor" headless, since it is by definition a UI Component. However, it is possible to load a Papyrus Model headless (Not with the PapyrusEditorFixture though)
Check org.eclipse.papyrus.junit.utils.rules.ModelSetFixture or org.eclipse.papyrus.infra.emf.readonly.ReadOnlyManagerTest
HTH,
Camille]]>Camille Letavernier2019-03-01T11:06:47-00:00Re: Need to run JUnit plug-in test with no GUI
https://www.eclipse.org/forums/index.php/mv/msg/1097860/1803499/#msg_1803499
Thanks Christian and Camille!]]>Alberto Debiasi2019-03-01T16:44:35-00:00