Add Testing Command

This topic explains how you enter a command for performing unit testing on your code.

The command is entered in the text box using the standard Windows Command Line commands. A sample script would contain a line to execute the testing tool of your choice, with the filename of the executable produced by the Build command as the option. To execute this test select the Project | Execution Analyzer | Test menu option.

Testing could be integrated with any test tool using the command line provided, but in these examples you can see how to integrate NUnit and JUnit testing with your source code. Enterprise Architect provides an inbuilt MDA Transform from source to Test Case, plus the ability to capture xUnit output and use it to go directly to a test failure. xUnit integration with your model is now a powerful means of delivering solid and well-tested code as part of the complete model-build-test-execute-deploy life-cycle.


NUnit and JUnit must be downloaded and installed prior to their use. Enterprise Architect does not include these products in the base installer.

The Capture Output checkbox enables Enterprise Architect to show the output of the program in the Output window, while the Output Parser field specifies what format output is expected. When parsing is enabled, double-clicking on a result in the Output window opens the corresponding code segment in Enterprise Architect's code window.

Selecting the Build before Test checkbox ensures that the package is recompiled each time you run the test.

Two example test scripts are included below. The first is an NUnit example that shows the Build before Test checkbox selected. As a result, every time the test command is given it runs the build script first.



The command listed in this field is executed as if from the command prompt. As a result, if the executable path or any arguments contain spaces, they must be surrounded in quotes.

The second example is for JUnit. It doesn't have the Build before Test checkbox selected, so the build script won't be executed before every test, but as a result it could test out of date code. This also shows the use of %N, which is replaced by the fully namespace-qualified name of the currently selected Class when the script is executed.