Naming Convention
Example
<Artifact Being Tested> MUT
SDCMAN Read Surf Board DAS MUT

Unit tests are designed to test individual aspects of the model in isolation without having to run through the the entire process. Unit tests can either be performed manually by stepping through code in a debugger or fully automated using a unit test framework. There are merits in using both approaches, for example manual tests may be written for all model artifacts including coach services whereas automated tests can be executed frequently to detect when bugs have been introduced. This design pattern is concerned with manual unit testing.

NOTE: A unit test framework is also available for automated unit testing.

Manual unit test services are used to test other model artifacts (usually services and BPDs). BPM Developers are encouraged to create a manual unit test for each model artifact at the same time as the artifact is developed. It should be possible to test all aspects of the model without having to run through the entire process.  Manual unit test services have the same name as the artifact being tested with a MUT suffix. Manual unit test services should reside in a folder called Unit Test directly above the artefact being tested, as illustrated in Figure 1.




Unit Test - Folder




Figure 1: Manual Unit Test Folder

Manual unit test services do not have any input or output parameters, so they can be run in isolation. The artifacts being tested usually do have input and output parameters, so it is necessary to prepare test data before invoking the artifact under test and examine the result once the output parameters have been passed back, as illustrated in Figure 2.




Unit Test - Example




Figure 2: Manual Unit Test Service

The style of the manual unit test may vary depending on the artifact under test. Different test data may be required to test various scenarios. A coach may be used to allow the tester to enter different test data. Depending on the complexity of the output parameters it may be more appropriate to run the test in debug mode to allow the tester to view the result rather than use a coach to display it.