Rebuild alternative using Spock Framework #169
Replies: 15 comments
-
Few things to still implement on the BPMN-js Javascript side: Transaction boundries, Aysnc, User Tasks, and executed activity colors. All of the data is available already, just need to add the logic in the final report. Also the bare bones code is not setup to handle multiple BPMN definitions in a single spec, or when there are multiple pools in a single bpmn file. These were skipped as they were known issues that has solutions, it was just a matter of writing the final logic to do the "If/Then" conditions. |
Beta Was this translation helpful? Give feedback.
-
Added Multi-Feature Support: |
Beta Was this translation helpful? Give feedback.
-
Here is a update with Multi-Iterations support and data tables: |
Beta Was this translation helpful? Give feedback.
-
Added support for receive tasks, catch events, and unfinished activities: |
Beta Was this translation helpful? Give feedback.
-
Updated with further refinements and better theme |
Beta Was this translation helpful? Give feedback.
-
The font would freak me out ;) |
Beta Was this translation helpful? Give feedback.
-
Hah @ThorbenLindhauer I was thinking it gives the feel of "wireframes": like a process under review, in development. It is just a bootswatch theme. So you can just flip out one theme for whichever. But it also gives me comic sans feels. |
Beta Was this translation helpful? Give feedback.
-
@ThorbenLindhauer is this more mentally stabilizing for you? ;) my goal was to use out of box bootstrap with basic/limited modifications as to keep the template as simple as possible for others to customize as they wish; rather than have a template riddled with complex theme adjustments. |
Beta Was this translation helpful? Give feedback.
-
Updated for support of activating a coverage map any point during the unit test. Meaning you can have multiple coverage snapshots during a single feature. xref: #35 |
Beta Was this translation helpful? Give feedback.
-
Here is a update from some discussions with the vPAV devs: This is showing data flow/variable usage throughout process: when variables are created, updated, or deleted, the details are collated as part of the coverage to see where data modification is occurring. |
Beta Was this translation helpful? Give feedback.
-
Hey! Okay so i have wrapped the coverage builder into a isolated coverage builder that does not use Spock Framework or Spock Reports https://github.com/DigitalState/camunda-coverage-generation-groovy The tool allows someone to generate "coverageSnapshots" through their test(s) and then "save" the snapshots at any point. The idea being that this can be incorporated into a larger testing report such as the Spock Reports examples in my previous posts above, or it can just be used stand alone to generate the HTML files. |
Beta Was this translation helpful? Give feedback.
-
As per discussion on DigitalState/camunda-coverage-generation#9, I have added a new class to the coverageGenerator which now allows JUnit and pure Java usage. Groovy is still a hard dep for under the hood operations, but you can now use the Coverage Generator directly from your Java Unit Tests package coveragetest;
import io.digitalstate.camunda.coverage.bpmn.CoverageBuilderJavaBridge;
import org.camunda.bpm.engine.runtime.ProcessInstance;
import org.camunda.bpm.engine.test.Deployment;
import org.camunda.bpm.engine.test.ProcessEngineRule;
import static org.camunda.bpm.engine.test.assertions.ProcessEngineTests.*;
import org.junit.Rule;
import org.junit.Test;
/**
* @author Daniel Meyer
* @author Martin Schimak
*/
public class SimpleTestCase {
@Rule
public ProcessEngineRule rule = new ProcessEngineRule("camunda_config/camunda.cfg.xml");
CoverageBuilderJavaBridge coverageBuilder = new CoverageBuilderJavaBridge();
@Test
@Deployment(resources = {"testProcess.bpmn"})
public void shouldExecuteProcess() {
// Given we create a new process instance
ProcessInstance processInstance = runtimeService().startProcessInstanceByKey("testProcess");
// Then it should be active
assertThat(processInstance).isActive();
// And it should be the only instance
assertThat(processInstanceQuery().count()).isEqualTo(1);
// And there should exist just a single task within that process instance
assertThat(task(processInstance)).isNotNull();
// When we complete that task
complete(task(processInstance));
// Then the process instance should be ended
assertThat(processInstance).isEnded();
coverageBuilder.coverageSnapshot(processInstance);
coverageBuilder.saveCoverageSnapshots();
}
} and remember you can do interesting coverage generation scenarios such as: package coveragetest;
import io.digitalstate.camunda.coverage.bpmn.CoverageBuilderJavaBridge;
import org.camunda.bpm.engine.runtime.ProcessInstance;
import org.camunda.bpm.engine.test.Deployment;
import org.camunda.bpm.engine.test.ProcessEngineRule;
import static org.camunda.bpm.engine.test.assertions.ProcessEngineTests.*;
import org.junit.Rule;
import org.junit.Test;
/**
* @author Daniel Meyer
* @author Martin Schimak
*/
public class SimpleTestCase {
@Rule
public ProcessEngineRule rule = new ProcessEngineRule("camunda_config/camunda.cfg.xml");
CoverageBuilderJavaBridge coverageBuilder = new CoverageBuilderJavaBridge();
@Test
@Deployment(resources = {"testProcess.bpmn"})
public void shouldExecuteProcess() {
// Given we create a new process instance
ProcessInstance processInstance = runtimeService().startProcessInstanceByKey("testProcess");
// Then it should be active
assertThat(processInstance).isActive();
// And it should be the only instance
assertThat(processInstanceQuery().count()).isEqualTo(1);
// And there should exist just a single task within that process instance
assertThat(task(processInstance)).isNotNull();
coverageBuilder.coverageSnapshot(processInstance);
// When we complete that task
complete(task(processInstance));
// Then the process instance should be ended
assertThat(processInstance).isEnded();
coverageBuilder.coverageSnapshot(processInstance);
coverageBuilder.saveCoverageSnapshots();
}
} which would generate two snapshots: first would be before the User Task is completed, and the second would be after the process instance has completed. |
Beta Was this translation helpful? Give feedback.
-
I have added further refinements to support more features: As of 0.7
|
Beta Was this translation helpful? Give feedback.
-
Hey
so building from the covo in #28 and #31, i have put together a alternative to the current coverage implementation:
This is a spock framework report that integrates BPMN-js and the coverage results.
I am iteratively adding features to be feature equivalent to the current workarounds that bpmnCoverage implements:
so far i have setups for:
The sequence flow is added currently using a Script that is added into the BPMN before the BPMN is loaded into the engine:
and the script being:
this script is going to be rebuilt as a Groovy script to align with Spock.
will also be making updates as per @ThorbenLindhauer discussions on: https://forum.camunda.org/t/execution-listener-on-sequence-flow-generate-history-event/7586/2
The goal of the coverage reporting is to provide a more script based reporting solution for Coverage; and make is very easy for typical technical business users to update reports with additional queries as they see fit.
We are also looking to only use built in camunda services and not modify the engine (so far so good / not needed, but it's not a hard "no"; just preferable) so we can easily add the unit testing to any implementation.
Beta Was this translation helpful? Give feedback.
All reactions