Following a rigorous methodology is key to delivering customer satisfaction and expanding analytics use cases across the business.
A unit test in C++ and Java is well tested and well known. ActiveVOS develops BPEL which does not behave in the same way as 3GL languages, and therefore, the same rules for unit testing do not always apply. It is still important that any code that can be unit tested should be unit tested. This document provides best practices for unit testing ActiveVOS code and ensuring that a BPEL process is well tested in ActiveVOS designer.
This Best Practice does not explain the usage of the ActiveVOS provided Unit testing, but instead describes what should be tested as opposed to which tool should be used. There are times when Java (as well as other third party code) is called from an ActiveVOS process. It is assumed that third party code is unit tested in its own environment. Other testing involving third party code would be Integration testing and System testing, which are out of scope for this document.
For any given ActiveVOS process there are a number of paths that a process can take. Ideally, each of these paths should be unit tested via process simulation before deployment, as well as via actual execution via unit tests after deployment. For each path that is tested the resulting data should match the expected data.
There is usually at least one happy path for every process (there may be more than one).
Count each path in a conditional pattern as well as the Else Path.
When a process has a loop there are three possible scenarios:
Receives (other than the initial receive) relate to consumers that are not the activity that instantiates the process. These include Message receives, asynchronous replies from partner services/callbacks and signals. There are three conditions for receive:
When a process has an Event there are three possible scenarios:
Even if a process has no fault handler, at least one fault should be tested. This should cause the process to terminate. For each fault handler the code should be tested with a fault and without a fault. If a receive has more than one potential fault, each fault should be tested as well as no fault.
These are expressions placed manually on links that evaluate to true or false. Each transition condition should be tested with a logical true and a logical false.
Each compensation path should be marked for test.
For each path, establish what data is needed. Usually the execution path a process takes at runtime is determined by data values in the messages being received by the process. Prepare appropriate test data messages that will cause all possible paths of execution to be tested.
There may be paths in code that are dependent on runtime behavior that cannot be mimicked in design time. Document any path that cannot be unit tested.
The simplest way to unit test in ActiveVOS designer is to use the process simulation feature. Paths can be tested, but changing data during simulation can save time and allow testing of situations that are difficult to mimic using the same data from start to finish.
Documentation can either be detailed or summarized. For example:
Process |
Paths |
Tests |
Success |
Fail |
Could not Run |
Note |
GHI |
7 |
6 |
6 |
|
1 |
System Test Needed |
ABC |
23 |
23 |
23 |
0 |
|
|
DEF |
20 |
20 |
19 |
1 |
|
Unexpected Data |
Or the path and the request and response data can be documented for each path. This is a more detailed approach that can be taken for more complex scenarios or where there are nuances in the data or logic that might be obscured by the summary format above.
Process |
Path |
Input List |
Output List |
Description |
Result |
ABC |
3 |
|
|
|
|
ABC |
1 |
xxx.xml, yyy.xml… |
www.xml, zzz.xml… |
This is the Happy path |
Success |
ABC |
2 |
|
|
|
|
Success
Link Copied to Clipboard