Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » Papyrus » Need to run JUnit plug-in test with no GUI
Need to run JUnit plug-in test with no GUI [message #1803474] Fri, 01 March 2019 10:55 Go to next message
Alberto Debiasi is currently offline Alberto DebiasiFriend
Messages: 84
Registered: March 2018
Member
Hello everybody,

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
Re: Need to run JUnit plug-in test with no GUI [message #1803477 is a reply to message #1803474] Fri, 01 March 2019 11:04 Go to previous messageGo to next message
Christian Damus is currently offline Christian DamusFriend
Messages: 1270
Registered: July 2009
Location: Canada
Senior Member

Hi, Alberto,

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
Re: Need to run JUnit plug-in test with no GUI [message #1803478 is a reply to message #1803474] Fri, 01 March 2019 11:06 Go to previous messageGo to next message
Camille Letavernier is currently offline Camille LetavernierFriend
Messages: 951
Registered: February 2011
Senior Member
Hi Alberto,

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 Letavernier
Re: Need to run JUnit plug-in test with no GUI [message #1803499 is a reply to message #1803478] Fri, 01 March 2019 16:44 Go to previous message
Alberto Debiasi is currently offline Alberto DebiasiFriend
Messages: 84
Registered: March 2018
Member
Using the ResourceSetFixture the test works in Headless Mode.

Thanks Christian and Camille!
Previous Topic:Ternary connector in component diagram
Next Topic:Any fundamental changes in next Papyrus release?
Goto Forum:
  


Current Time: Tue Mar 19 06:47:05 GMT 2024

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

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

Back to the top