JUnit testing and Sirius [message #1802948] |
Tue, 19 February 2019 08:37  |
Eclipse User |
|
|
|
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?
Thanks!
|
|
|
|
Re: JUnit testing and Sirius [message #1803122 is a reply to message #1802987] |
Fri, 22 February 2019 13:33   |
Eclipse User |
|
|
|
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 https://www.eclipse.org/sirius/doc/developer/Architecture.html), 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 org.eclipse.sirius.tests.support.api. The main use we've gotten out of that is using org.eclipse.sirius.tests.support.api.TestsUtil.waitUntil(...) to have our tests wait for asynchronous activities to complete.
[Updated on: Fri, 22 February 2019 13:36] by Moderator
|
|
|
Re: JUnit testing and Sirius [message #1835920 is a reply to message #1802948] |
Wed, 16 December 2020 09:34  |
Eclipse User |
|
|
|
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.
|
|
|
Powered by
FUDForum. Page generated in 0.03483 seconds