Code Coverage for BPMN

Introduction

I visited a customer recently who asked a very interesting question…. they’d been performing a series of stress tests of their BPM project made up of many & complex BPM processes and they wanted to know if there were any activities/paths in any of their processes which they hadn’t traversed… sort of like “Clover” for BPM, This led me to thinking about BPM auditing and cross-referencing this with the BPM activities.

BPMN Code Coverage: The Theory

Let us take a look at the relevant tables in the SOAINFRA schema….

BPM_AUDIT_QUERY

Providing that the audit level has been set sufficiently high (for example “Production” would do), this table stores details of all BPMN activities instantiated at any given time.

BPM_CUBE_ACTIVITY & BPM_CUBE_PROCESS

These tables are a static view of all activities in all deployed process at any given time.

Deployed BPM activities not in BPM_AUDIT_QUERY

It became obvious that selecting all activities in the join of BPM_CUBE_ACTIVITY and BPM_CUBE_PROCESS for a given deployed process/composite which did not exist in BPM_AUDIT_QUERY during a given time period would highlight activities not invoked as part of out testing. As a result I ended up with a piece of SQL thus….

CBPM_09

…i.e. which activities in processes “BpmClover” and “BpmCallable” were not traversed in the last 24 hours.

BPMN Code Coverage: The Practice

I needed a fairly simple process to test with, not too complex but with a good selection of activities, human tasks, boundary events, gateways etc… and ended up with the following (not BPMN best practices by any means)….

CBPM_01

…i.e. a main process and a callable sub-process.

Test the Conditional Gateway

The associated flow trace….

CBPM_02

…and the query result….

CBPM_03

…still a lot of activities not run.

Test the Default Gateway & Complete the User Activity

The associated flow trace….

CBPM_04

…and the query result….

CBPM_05

…so the callable sub-process has been run in full and the only things left to cover are the “boundary timer event” and associated “end”.

Test the Boundary Event

If we let the human activity time-out we get the associated flow trace….

CBPM_06

…and the query result….

CBPM_07

…i.e. nothing left to run.

Summary

There is one big caveat with this solution… we are querying the underlying SOAINFRA tables and these could change at any time with a new release of the product…. this testing was carried out against PS6. It’s also worth noting that the query does not take into account the composite version though this would be easy to add. This is however a quick and simple way of determining any gaps in testing, it would be very easy to create a PLSQL procedure from the SQL and parameterize the date range and process names to create a very flexible function.

Add Your Comment