camunda-community-hub/camunda-process-test-coverage

Coverage over 100% for processes

bulivlad opened this issue · 9 comments

Having multiple test methods, covering different scenarios on the same process will produce coverage above 100%.
The processes having coverage above 100% are call activities in the main process.

image

Was not able to reproduce this issue locally.
Could you please provide a report.json or report.html with this error?
That would help a lot in identifying the problem.

hi @rohwerj,

In this gist you have the report html and json + the bpmn file and test file I was using to reproduce the behaviour.
I'm really trying to mock the call activity with dummy process - either start->end process or start->throwing event - to focus on the main process.

Let me know if you need more details on it.

@bulivlad Are you also generating the dummy mock process in your real scenario? Could you share how you're doing that (source of the methods emptyExecutableProcess and throwingExecutableProcess is not included I think).
The problem here is probably, that the generated subprocess is included in the coverage, which always has different IDs for the activities and is therefore causing problems when calculating the coverage.
The best would be to have a test configuration that excludes the called sub process definition key in those tests, where you mock the process definition.
E.g.

@TestConfiguration
public class ExcludeDummyConfiguration {

    @Bean
    public ProcessEngineCoverageProperties processEngineCoverageProperties() {
        return ProcessEngineCoverageProperties.builder()
                .excludeProcessDefinitionKeys("call_activity")
                .build();
    }

}

@rohwerj yes, I'm creating dummy processes in real scenario to test the process in isolation without including call activities which are teste separately.
this is the code that creates the dummy process

    public static BpmnModelInstance emptyExecutableProcess(String processId) {
        return Bpmn.createExecutableProcess(processId)
                .startEvent()
                .endEvent()
                .done();
    }

I tried the solution you suggested and it is working fine.

also strange thing it's happening, I have a total of 24 tests running but the aggregated report json file is around 400MB and reporting around 2000 suites run.

@bulivlad
Creating a dummy process like you do, will create nodes with auto generated ids. That makes it impossible for the extension to match those to the ones in the model. It anyway makes no sense to include dummy processes in the coverage and it will even mess up the report, as that process model might overwrite the real one in the generated report.

@bulivlad
For 24 test clauses it's reporting 2000 suites? That really sounds strange and that might be a bug.
Or are there 2000 runs? Those are all test methods in the classes.
But even for that it sounds a little bit too much.
Can you somehow share the report files?

@bulivlad Could you open a new ticket with more information regarding the big report.json file? Then we can close this issue, as the coverage over 100% is adressed by excluding the dummy processes from the coverage.

sure @rohwerj, you can close this one. I'm trying to reproduce the big report file in a dummy project. I will open a new issue when I got it.
Thanks