How to run the unit module tests?
The unit module tests for Decision Architect leverage the Microsoft Visual Studio testing
framework. Select the TEST -> Windows -> Test Explorer menu item in Visual Studio to view and operate on the test set. Press the Run All link to execute all of the available tests.
When deployed as an add-in, Decision Architect provides the callback
EA_OnInitializeTechnologies to load the Decision Architect MDG into the runtime context. For the unit module tests this callback is not invoked and the MDG must be loaded by other
means. The simplest approach is to copy DecisionArchitectMDG.xml into Program Files/Sparx Systems/EA/MDGTechnologies (create the directory if it does not exist). Restarting Enterprise Architect will deploy the MDG.
Follow these steps if the example EA model gets corrupted or needs to be refreshed.
- Open Enterprise Architect and create a new project.
- Delete the existing example model, e.g. da\src\DecisionArchitectTests\EATestFiles\UnitTestExample.eap.
- Save the new model with the same name and location.
- In the Model Wizard dialog, choose Decision Architect for the Technology and Example System Architecture for the Name. Press the OK button to close the dialog.
- Close Enterprise Architect and rebuild the Decision Architect solution in Visual Studio.
- Check in the updated example model in TFS.
Follow these steps to add more tests to the DecisionArchitectTests project.
- In Visual Studio right mouse on one of the existing test files, e.g. EATests.cs. Select Copy and then Paste into the Tests Folder.
- Rename the copied file appropriate to the scope of the tests.
- Edit the file and change the class name, e.g. EATests -> EAMyTests. Remove the Test method and replace with your own method that exercises the appropriate properties and methods.
- Update the manifest below to reflect the additional unit module tests.
Current test manifest:
EATests - uses example EA model as a resource
EA_ConfirmMDG - verify Decision Architect MDG has been installed manually
EAConnectorTests - exercise EAFacade connector API
EA_ConnectorTests - IEAConnector properties and operations
EADiagramTests - exercise EAFacade diagram API
EA_DiagramTests - IEADiagram properties and operations
EAElementTests - exercise EAFacade element API
EA_ElementTests - IEAElement properties and operations
EAPackageTests - exercise EAFacade package API
EA_PackageTests - IEAPackage properties and operations
EAFacadeTests - exercise methods used by Decision Architect
EA_UpdateRepositoryTest - ensure the Repository singleton is initialized
EA_WrapElement_eventPropertiesTest - create an object that adds instance properties to a diagram object element with the ID specified in the event properties
EA_WrapElement_elementTest - create an object that adds instance properties to a package element
EA_WrapConnectorTest - create an object that adds instance properties to a diagram connector
EA_WrapVolatileConnectorTest - create an object that adds instance properties to a diagram connector with the ID specified in the event properties
EA_WrapVolatileDiagramTest - create an object that holds the diagram ID specified in the event properties
EA_WrapVolatileElement_elementTest - create an object that adds instance properties to a package element with the ID specified in the event properties
EA_WrapVolatileElement_diagramTest - create an object that adds instance properties to a package diagram with the ID specified in the event properties