Unit Tests coverage in SONARQUBE - unit-testing

I can obtain the Unit Tests coverage in SONAR by using jacoco tool for code coverage and used its report in sonar properties file as 'sonar.jacoco.reportPath=../Reports/report.exec'. How to obtain the Unit Tests coverage in SONAR by using RAD's default plugin, which generates reports in .coveragedata, .analysis and .html formats?

This format is not supported. You have to find a way to convert the RAD reports to JaCoCo, Cobertura or Clover format.

Related

Code Coverage in python without unit tests

I have a python (Django) application for which I want to generate a code coverage report, but the solutions I have found on the internet mostly work with test runners or requires unit tests for example Coverage.py and pytest-cov. As I don't have unit tests for my code, is there any other options available that can do the coverage for my code without unit tests?

Integrating C++ coverage with sonarqube

I am using Google test framework for C++ unit tests. We are building our projects using MsBuild (runs on teamcity). Now, I want sonarqube to parse the coverage info. We have cfamily plugin in sonarqube. The compatible reports with cfamily plugin are bullseye, vscoverage, gcov, llvm-cov. As per my knowledge, because we can't use gcc for compiling, llvm-cov and gcov are ruled out. Since we are using googletest and also wants to run this on teamcity, vscoverage isn't possible. We aren't using Bullseye. (It is more for functional automation I am told).
So I have decide to use OpenCppCoverage tool. This can generate coverage in cobertura format or generic format specified by sonarqube. I have tried generic format but sonarqube is ignoring the coverage for files but is parsing them successfully.
Exploring more, I tried to use C++ community plugin(cxx). But I wasn't able to disable cfamily plugin so that C++ community can be used.
So I want to know if I can do something else so that coverage of our C++ test projects can be parsed by sonarqube.
Did you try sonar-cxx plug-in from SonarOpenCommunity. This plugin adds C++ support to SonarQube. It's free plug-in and availble with LGPL-3.0 License.
I made the paths in coverage report generated by OpenCppCoverage using OCCSonarQube plugin. Now SonarQube is able to parse the report in generic format.

Does the catch unit test framework support junit-style test reports?

Planning to switch over to the Catch unit test framework for c++.
I need the test results to be in junit report format and I just want to confirm if it has that capability.
Yes, it does.
You can generate a JUnit compatible XML report via adding
-r junit
to the command line of your compiled Catch test suite (cf. Integration with build systems).
A small amount of reading reveals:
Other core features
JUnit xml output is supported for integration with third-party tools, such as CI servers.

Does MSpec produce a TRX result file after running tests?

Does MSpec produce a TRX result file after running tests? If not, can it? The tests are being run with ReSharper.
The feature of ReSharper that you're talking about is just a test runner. It can run tests from MSTest, NUnit, and other frameworks by using custom plugins. MSpec is a completely separate test engine/framework.
MSpec can output a number of reports: TeamCity, HTML, and XML. I can't run MSpec to verify the XML output right now, but I did review the XML report generator code. It appears to write the "concern | context | specification" report that you can see in the HTML example. And not an MSTest TestResults file (.trx).
I don't see any way to output a TRX right now. You can submit an issue or write some kind of generator, but I don't know if it's worthwhile.

Branch-coverage with Cobertura plugin for the Play! Framework

I'm using the Play! Framework with the Cobertura module to get code coverage. This works fine, but unfortunately, the module seems to have no (obvious) option to make branch coverage reports too.
How do I enable branch coverage in the Cobertura module?
Or in other words, how do you test branch coverage in a Play application?
Branch coverage magically appears in the report now, maybe it was there all the time and I just didn't see it. My bad.