Problem when measuring IntelliJ Spring Boot Test Coverage on multi module project - spring

In my case, I run my whole multi-module test on IntelliJ like this:
The test works as intended, but there is a problem with measuring the test coverage.
If I run "Run With Coverage", only the test coverage of a specific module is measured properly, and the rest is set at 0%. If I do the gradle test for each module, the coverage for that module is over 90%. It's only a problem when testing the entire module, how can I fix it?

Related

How can I set-up Maven to create Jacoco coverage for tests for source code another module?

I have a multi-module Maven project. Many of the tests are in the conventional directory (src/test/java) but about 60% are in single module.
By default, Jacoco does not create coverage for those tests.
I'd like the tests in the single module to contribute to coverage.
Nb. We collects coverage in Sonar.
To fix this, set the following configuration item:
<inclNoLocationClasses>true</inclNoLocationClasses>

Can I fail my Maven build based on an existing Karma coverage report?

I use Maven to build a multi-component project. One of the components is a web app with HTML and JavaScript. Maven invokes NPM and Karma to run that component's unit and integration tests, written in QUnit. This yields two independent Cobertura coverage reports that I then combine into one with istanbul-combine.
As a final step, I'd like the Maven build to fail if that combined Cobertura report doesn't satisfy my coverage requirements. But how?
I've tried the Cobertura Maven Plugin, but it seems to be unfit to simply read an existing report and apply its check configuration. First, it needlessly repeats the build's tests ("Invokes the execution of the lifecycle phase test prior to executing itself."), then it finds that it cannot instrument the non-Java resources, then it simply stops, without any log output whatsoever.
Are there other plugins that fit? Could changing the report format help? (Doesn't have to be Cobertura.)

Is there any way to get the code coverage of a Concordion tests?

I have a Java Project with Concordian and Maven, and I would like to know if is there a way to get the code coverage of a Concordion tests?
take a look at Jacoco. It has a Maven plugin and can run locally or remotely.

Maven Multi-Module plus Extrenal Tests plus JaCoCo plus Sonar

On our company we have the several modules on project and each module has several unit tests, but we have system tests that based on classes and not modules. Our system tests use several classes of each module (not all). We cannot calculate intergration coverage and unit coverage of this tests. We want to merge results of system tests to calculate the coverage of all probuct.
Anyone have any idea how we can do this? Anyone can provide any tutorial with examples?
You can find a sample application that reproduces this case here: https://github.com/SonarSource/sonar-examples/tree/master/projects/code-coverage/combined%20ut-it/combined-ut-it-multimodule-maven-jacoco
This should help you.

OSGI Integration Testing and Code Coverage

We have Desktop app deployed in OSGI bundles and have integration tests to test bundles loaded in OSGI container.
I am seeking a tool that calculates code coverage for integration tests with OSGI bundles
Currently we are trying to do with Jacoco and Sonar that is good for integration tests code coverage, but we aren't sure whether they are good enough to handle OSGI integration test code coverage
also any other tools available to calculate OSGI integration test code coverage.
Most, if not all code coverage tools should work with OSGi. Their general strategy is to post process the bytecode to inject extra code that allows them to measure such coverage. The biggest issue that causes is that this code now usually has dependencies on extra code (the code coverage library). Such dependencies can either be made explicit (by adding Import-Package statements) just like with any other dependency.
The other option you have is to add the code coverage library to your bootclasspath so you don't need those extra imports (which breaks modularity, normally not something you want, but in this case irrelevant). Once you solve this problem, the rest is a matter of instrumenting the right bundles and aggregating the results of multiple different test runs.
We proceeded in second approach and it worked..Jacoco is able to provide Test Coverage of OSGI integration test and show in Sonar DashBoard.

Resources