The plugin org.polarsys.capella.test.framework define basic test cases and tests suite.
Capella exisiting junits are currently written with JUnit3. Note that this will evolve at some point
org.polarsys.capella.test.framework
public abstract void test() throws Exception; //content of the test
public List<String> getRequiredTestModels(); //list of models to import before the test
protected List<BasicTestCase> getTests(); //list of tests to run
public List<String> getRequiredTestModels(); //OPTIONAL, list of models to import before the testsuite
When the model is defined at the test suite level, the test case are not allowed to modify the content of the model.
Test for the creation of elements in the Project Explorer: CreateElement.java
getSession
to retrieve the opened session on the model. With a
Session
we have access to the
TransactionalEditingDomain
(allowing to execute commands) and then on the
ResourceSet
, the list of all loaded files.
By looking at how to Edit an element, it is possible to do some modification on the model (command to test) and then asserting that result is correct.
For instance, doing a Drag and Drop or Creating a REC/RPL ensuring that all references are created here
Diagram tests are more complicated to do, as it requires to open diagram, perform some manipulations and things like that.
In this plugin, many
DiagramContext
defining all tools
org.polarsys.capella.test.diagram.common.ju.context, like
Interface Diagram Blank
In a Junit, a use of this diagram context, CreateInterface.java testing that the tool is enabled and create correct element in the right container. (All the asserts are done in super implementations, so the test is readable even if we think it does nothing).
Some other samples, CreateFunction.java or PABStyleChecksDiagramElements.java
org.polarsys.capella.test.diagram.common.ju