Add Testing Command

This topic explains how to configure the Test Page of an Analyzer Script for performing unit testing on your code.

In order for this to be possible, you must first create a Build script for the appropriate package.

Access    Analyzer | Execution Analyzer (Shift+F12) : New (Toolbar icon) > Test > Test
                  Analyzer | Execution Analyzer (Shift+F12) : locate and double-click on required script > Test > Test

Topics

Topic

Detail

See also

Usage

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.

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 inbuilt MDA Transforms 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 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.

 

Managing Analyzer Scripts

 

Add Build Commands

 
JUnit Transformation

NUnit Transformation

 

Unit Testing

Execute Command As:

Process

Enter the path to a program or batch file to run followed by any parameters.

Batch File

When using this option you can enter multiple commands, which are then executed as a single script in a command console; you have access to any environment variables available in a standard command console.

 

 

Example

NUnit

"C:\Program Files\NUnit\bin\nunit-console.exe "pin\debug\Calculator.exe"

JUnit

java junit.textui.Testrunner %N

 

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.

 

 

Default Directory

Preset to the Build default directory.

 

Add Commands

Parse Output

Selecting an Output Parser causes output from the command(s) to be captured to the Output window; the Output Parser field specifies the syntax to be expected.

Double-clicking on a result in the Output window opens the corresponding code segment in Enterprise Architect's code window.

 

 

 

 

Locate Compiler Errors in Code

Build First

Select to ensure that the package is recompiled each time you run the test.

If you include the string %N in your test script it is replaced by the fully namespace-qualified name of the currently selected Class when the script is executed.

 

 

Learning Center topics

(Alt+F1) | Enterprise Architect | Build and Debug | Test