Testing business processes can take a lot of time and resources. To test all the possible variations and different scenarios in a complex business process manually, can be quite challenging and time-consuming. This is further evident when we take into account that business process management processes are usually long running. This means that finding a bug by utilizing an iterative process can take several days as there may be thousands of process instances running on the potentially bug-affected process. Therefore, there is a need for a sophisticated testing framework for BPM platforms. And it is evident that automation is crucial. There are a few different ways to implement automated testing. Let us have a closer look at the key methods.
Unit testing with JUnit
JUnit is an open source unit testing framework. It is ready to use, well-known to Java developers and it is easy to use as almost everything can be expressed in Java code. This is the best tool for low level testing of technical aspects, such as testing services and REST APIs.
However, it has some disadvantages, such as when it comes to more business-oriented end-to-end testing. Testing in this instance is usually performed by business and test analysts, who may not be familiar with Java. Also, writing unit tests can be very time consuming. Last but not least, you need to build up a special infrastructure, because JUnit cannot be run directly from the workflow engine.
Using process modeling to define test procedures
A very interesting option is to use business process modeling and notation (BPMN) for testing. Using BPMN to write the test cases can bring about many benefits. It allows process modelers, such as test and business analysts, to design the tests in their usual manner on a user-friendly level.
Tests are event based and tasks can be tested step by step. Different input variables can be used and assertions tested. To achieve this though, the pallet of workflow nodes needs to be extended. New nodes need to be specifically prepared for testing. This makes the testing more user friendly and flexible. Process events (such as deploy, start, complete) can be designed manually, while evaluation is part of the process test definition.
With these two methods, the possibilities are huge. But what about testing something in an environment that comes close to the real world?
Simulations are the answer. For simulations, different virtualised situations can be applied and tested. The goal here is to simulate a variety of states in a fast and efficient manner. Imagine you want to test a car and you would like to run the car to the end of a pre-defined route but you also want to see its performance with different weather conditions. With virtualisation, the same flows can be retested under different circumstances very quickly and easily.
If your workflow management platform runs on the Activiti engine, then Activiti-Crystalball could be a good solution to implement this virtualisation for testing. With the appropriate tooling, it is easy to reuse data, start simulations and then to replay the workflow behaviour from the set-up history.
For developers, unit testing is a natural thing to do. Concluding unit tests is always useful, especially with the focus on testing at lower rather technical levels. Process testing is the friendlier option for process modelers too. In order to test a process efficiently under different complex circumstances, concluding simulations is a cost-effective and time-saving method to do so.
Last but not least, the magic lies in finding the right mix between the mentioned options as all the different options follow their own specific purpose, but finding the right combination means they can complement each other to achieve more effective results.