Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.

Bug 423663

Summary: Provide a clean and simple structure to test Sirius
Product: [Modeling] Sirius Reporter: Hugo Marchadour <hugo.marchadour>
Component: RelengAssignee: Project Inbox <sirius.releng-inbox>
Status: RESOLVED WONTFIX QA Contact:
Severity: enhancement    
Priority: P3 CC: alex.lagarde, laurent.redor, pierre-charles.david
Version: 0.9Keywords: triaged
Target Milestone: ---   
Hardware: All   
OS: All   
Whiteboard:
Attachments:
Description Flags
Light sample of plugin dependencies in Sirius
none
Sample of test dependencies
none
Sample of test dependencies none

Description Hugo Marchadour CLA 2013-12-10 04:32:33 EST
In this task, we will work on the way to test efficiently, cleanly and easily Sirius.

We have several kinds of tests in mind : 
* Unit test that tests the expected behavior of a single Java class
* Integration test that tests the expected behavior of a set of Java classes and that is generally in a plugin context but not necessarily
* UI test that tests the expected graphic render
* install/deinstall test that tests that Sirius update-site can be installed on Eclipse Modeling...

All of these tests need to be stored somewhere.
Generally, we could have a org.eclipse.sirius.tests for Unit and Integration tests and a org.eclipse.sirius.tests.ui for UI tests.
In another hand, after several years, it could become both sets of tests really hard to maintain. We may find another organization.


We can use JUnit, EasyMock and SWTBot. We need to take a few time to check interesting features in each technology.


We certainly need to make a simple test API, especially for UI testing.
Comment 1 Hugo Marchadour CLA 2013-12-10 04:47:23 EST
A little clarification, we start with a set of legacy Junit and SWTBot tests that we need to import in Sirius with the API clean process. The purpose of this task is to target a new test system.
Comment 2 Hugo Marchadour CLA 2013-12-10 05:34:40 EST
Created attachment 238192 [details]
Light sample of plugin dependencies in Sirius
Comment 3 Hugo Marchadour CLA 2013-12-10 07:50:07 EST
I've in mind an organization like this :
For each plugins, we can have its associated "*.tests" plugin in a dedicated folder called "tests" or "test-plugins" [1].


If the plugin under test is an headless plugin, it could contain unit and integration tests.
If the plugin under test is an UI plugin, it could contain unit, integration and UI tests.
In both cases, we have the minimal plugin dependency context during the test execution.

Another test plugin called "org.eclipse.sirius.runtime.tests" could contain integration tests that have all sirius plugins in dependencies.
It could also replay all integration tests.

Another test plugin called "org.eclipse.sirius.runtime.ui.tests" could contain ui tests that have all sirius plugins in dependencies.
It could also replay all ui tests.

[1]
* plugins/org.eclipse.sirius -> tests/org.eclipse.sirius.tests
* plugins/org.eclipse.sirius.common -> tests/org.eclipse.sirius.common.tests
* plugins/org.eclipse.sirius.ecore.extender -> tests/org.eclipse.sirius.ecore.extender.tests
* plugins/org.eclipse.sirius.common.ui -> tests/org.eclipse.sirius.common.ui.tests
* plugins/org.eclipse.sirius.ui -> tests/org.eclipse.sirius.ui.tests
Comment 4 Pierre-Charles David CLA 2013-12-10 08:42:29 EST
See also http://wiki.eclipse.org/Sirius/Modularization#Automated_Tests
Comment 5 Hugo Marchadour CLA 2013-12-11 11:43:15 EST
For a UI plugin, we will separate JUnit tests (Unit and integration tests) to Swtbot tests. These both cases haven't the same way to be launch in Tycho. (Expecially for useUIHarness and useUIThread tycho-surefire-plugin configurations)
Comment 6 Hugo Marchadour CLA 2013-12-11 11:44:40 EST
Basically, for org.eclipse.sirius.common.ui, we will create org.eclipse.sirius.common.ui.tests and org.eclipse.sirius.common.ui.tests.swtbot.
Comment 7 Hugo Marchadour CLA 2013-12-11 11:48:29 EST
To separate Unit and Integration tests, we may have a dedicated source folder /unit /integ. For package names, we will follow the package of the Class under test. For the integration test, it's still to define.
Comment 8 Hugo Marchadour CLA 2013-12-12 03:46:17 EST
About a common SDK for testing, we have several things in mind.

Firstly, all generic test helpers that could be proposed as Eclipse submission (like a generic wait condition) will be added in the library extensions.

For example:
* org.eclipse.sirius.ext.junit
* org.eclipse.sirius.ext.swtbot

Secondly, all generic Sirius test helpers could be added in:
* org.eclipse.sirius.sdk.test
* org.eclipse.sirius.sdk.test.swtbot

Thirdly, all other generic test helpers could be added in its dedicated test plugin. For example, tests/org.eclipse.sirius.ui.tests could contain several generic test helpers that will be only reused in the org.eclipse.sirius.ui.tests scope. These helpers haven't any vocations to be shared to other tests plugins. In deed, it will too hard to manage durably test dependencies. If an hepler need to be shared, it will be moved in sdk.test or sdk.test.swtbot.
Comment 9 Hugo Marchadour CLA 2013-12-12 04:49:25 EST
Created attachment 238271 [details]
Sample of test dependencies
Comment 10 Hugo Marchadour CLA 2013-12-12 05:09:13 EST
Created attachment 238275 [details]
Sample of test dependencies

I add a missing dependency from sdk.test.swtbot to sdk.test. In deed, we can want to reuse the test contextualization already done in sdk.test to avoid code duplication.