Creating Reports

To create coverage reports for your BPMN and DMN models, you need to follow a few steps. On this page, you will find detailed instructions on how to create coverage reports. We will outline step-by-step how you can integrate FlowCov into your existing project to generate workflow coverage reports during build time.

If you still have questions after reading this page, please contact us as described here.

TL;DR

You can find an example implementation in this repository.

Adding the dependency

tip

Make sure to always use the latest version. You can find all available versions here.

First, you need to add the dependency to our testing library to your project. In this documentation, we will describe how to do that using Gradle and Maven. If you are using some other build system, visit its documentation for further instructions.

Adding the dependency
build.gradle
implementation "io.flowcov:flowcov-camunda-core:0.2.1"

Enabling the rule

warning

Please ensure you are using JUnit 4! JUnit 5 is currently not supported.

To enable FlowCov to log your tests, you need to enable the testing rule in your test classes. This needs to be done in every class containing unit tests.

@Rule
@ClassRule
public static ProcessEngineRule rule = FlowCovProcessEngineRuleBuilder
.create()
.build();

Using Spring

If you are using Spring for running your process tests, you need to provide your own in-memory process engine configuration. If you don't do this, you will use the default Camunda configuration and no coverage reports will be generated! You can find an example for an in-memory process engine configuration here.

Then, you need to import your memory configuration into your test class like this:

ProcessTest.java
@RunWith(SpringJUnit4ClassRunner.class)
@Deployment(resources = { "process_test.bpmn" })
@ContextConfiguration(classes = {InMemProcessEngineConfiguration.class})
public class ProcessTest {
// ...
}

Within this class, you can then initialize the testing rule like this:

ProcessTest.java
@RunWith(SpringJUnit4ClassRunner.class)
@Deployment(resources = { "process_test.bpmn" })
@ContextConfiguration(classes = {InMemProcessEngineConfiguration.class})
public class ProcessTest {
@Autowired
private ProcessEngine processEngine;
@Rule
@ClassRule
public static ProcessEngineRule rule;
@PostConstruct
public void init() {
if (rule == null) {
rule = FlowCovProcessEngineRuleBuilder
.create(processEngine)
.build();
}
}
// Your unit test methods
}

Running your tests

As soon as you have added the dependency and enabled the rule in your test classes, you can run your tests to generate coverage data.

If you open the /target/flowcov/ folder in your project, you will find a folder generated for each of your test classes. Each of them contains a file named flowCovReport.json. These files contain all coverage data generated while running your tests. You can upload these files to FlowCov.io to merge the data and visualize the coverage of your repository.