Background: I have 2 separate java projects, call them A and B. Project A is the actual product (war application), with unit-tests. Gradle builds the project and then runs sonar analysis, and I can see the unit-tests coverage in Sonar. Project B is an integration test for the first project. It is run by Jenkins in a pipeline after building project A and deploying it on an integration-environment. The deployment also involves instrumenting the code so that the jacoco-it report will correlate to Project A's classes.
My question: How can I add to project A's sonar page, which currently has only unit-tests coverage, the integration tests coverage - as a second step?
The flow I need is:
- build project A
- run sonar analysis on project A (now it'll show unit-tests coverage on its sonar page)
- build project B
- run sonar analysis on project B - which will simply add integration-coverage to project A on sonar
It's currently not working. when I run sonar analysis on project B it messes up project A's sonar page, removing the unit-test coverage of A.
The flow that I have now, which is working but I want to change is:
- build project A
- run sonar analysis on project A
- build project B
- run jacoco report on project B. this outputs the jacoco-it.exec file into a specific location on my disk
- run sonar analysis on project A (it has a setting to take the jacoco-it.exec file from the specified location
- now project A's sonar page will show both unit-tests and integration-tests coverage, but step 5 is completely redundant and I want to avoid it.
Any suggestions?