Skip to main content

Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Sirius » JUnit testing and Sirius
JUnit testing and Sirius [message #1802948] Tue, 19 February 2019 13:37 Go to next message
Lutz Wrage is currently offline Lutz WrageFriend
Messages: 181
Registered: July 2009
Senior Member
We have a diagram editor based on Sirius. We now want to write JUnit tests but have a hard time finding introductory examples and documentation. We fond the tests in the Sirius git repository, but without further explanation it is hard to understand what is going on and why. Are there any other resources available that we missed? Maybe we didn't look in the right places.

Also, the tests in the git repo seem to be written as JUnit3 tests. Is there any support available or planned for testing with JUnit5?

Re: JUnit testing and Sirius [message #1802987 is a reply to message #1802948] Wed, 20 February 2019 09:48 Go to previous messageGo to next message
Pierre Guilet is currently offline Pierre GuiletFriend
Messages: 250
Registered: June 2017
Senior Member

Sadly there is no current plans to switch to JUnit5.
There is no documentation available excepted the javadoc of the Sirius testing API.
What I recommand is to do SWTBot tests with Sirius API. They will be more easy to do than pure Junit plugin ones. Or even RCPTT tests.
For SWTBot you have the test class API AbstractSiriusSwtBotGefTestCase that you should extend and that provides you with methods to open editors, to execute tools, to retrieve edit parts that are the graphical elements available in your diagram representation.

Then there is no other choice that looking at already existing tests to apprehend the framework usage.
But basically you use copyFileToTestProject(Activator.PLUGIN_ID, DATA_UNIT_DIR, MODEL, SESSION_FILE); to put your model and aird file from which you will be doing your tests.
Then you open your representation that is a diagram or a table or a tree one. with available methods.
Then you test your tools or other kind of things with provided methods also.
Then you verify that it is working by checking changes on graphical elements that are edit parts.


Pierre Guilet - Obeo
Need training or professional services for Sirius?

[Updated on: Wed, 20 February 2019 09:56]

Report message to a moderator

Re: JUnit testing and Sirius [message #1803122 is a reply to message #1802987] Fri, 22 February 2019 18:33 Go to previous messageGo to next message
Tjalling Ran is currently offline Tjalling RanFriend
Messages: 4
Registered: February 2019
Junior Member
Hi Lutz,

You can have your JUnit classes extend from SiriusDiagramTestCase, which adds lots of convenience (including data members such as semanticModel and session). We usually use SiriusDiagramTestCase#genericSetup() to set up a session with a model, an .odesign and a .aird file, then go from there. Diagrams from the .aird file can be obtained through getRepresentations(...). Once you have the diagram, you can get nodes and edges, etcetera. Depending on the test, it may sometimes be necessary to have an open editor for a diagram as well, e.g. using DialectUIManager.INSTANCE.openEditor(...).

SiriusDiagramTestCase has a lot of methods for applying tools (such as the ones shown in the palette of your Sirius-based editor, as defined in the .odesign) to manipulate the model. This way, you can e.g. check whether a NodeCreationTool that you specified works as intended.

The API of SiriusDiagramTestCase, combined with the documentation that gives the basics and core classes of programatically using Sirius (see, can get you a long way. Still, there's plenty to figure out by yourself, so it'll take time, especially for the first couple of tests.

Also, there are test support APIs in The main use we've gotten out of that is using to have our tests wait for asynchronous activities to complete.

[Updated on: Fri, 22 February 2019 18:36]

Report message to a moderator

Re: JUnit testing and Sirius [message #1835920 is a reply to message #1802948] Wed, 16 December 2020 14:34 Go to previous message
George Aristov is currently offline George AristovFriend
Messages: 1
Registered: December 2020
Junior Member
Hi, Lutz

I now have the same problem.

We create diagram editor based on Sirius and now we need to create automatic test for UI.

But to find informations manuals - it's really difficult.

How did you solved your problem?

I tried to use RCPTT but it's not comfortable to create tests using XY of mouse point in diagram editor.
Previous Topic:Nodes with Pins
Next Topic:How to add a semantic resource with relative path
Goto Forum:

Current Time: Wed Nov 30 08:29:09 GMT 2022

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

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

Back to the top