In this section:

Introduction

The Parasoft Findings Plugin for SonarQube allows you to view static analysis, functional test results, unit test results, and code coverage results within SonarQube. It grants SonarQube the ability to analyze data from Parasoft XML reports and use it to report bugs, vulnerabilities, functional test results, unit test results, code coverage or code smells from within SonarQube. See Uploading Project Results for more details.

The plugin can consume the following report types:

Requirements 

Installing the Parasoft Findings Plugin

  1. Either download the plugin or build it yourself (10.6.2+ only):
    1. To download the plugin, go to https://customerportal.parasoft.com/lightningportal/s/marketplace and download the Parasoft SonarQube plugin jar parasoft.findings.sonar-<VERSION>.jar.
      • Be sure to download the version of the plugin that matches the version of your Parasoft product. For example, if you are using Jtest, dotTEST, or C++Test 2023.1, you would download parasoft.findings.sonar-2023.1.jar.
    2. To build the plugin yourself, see Building Your Own Plugin.
  2. Copy the plugin jar into the SonarQube extensions/plugins directory.
  3. Restart the SonarQube server.
  4. For version 10.6.1: set the root path to the Parasoft product (see Setting the Root Path to the Parasoft Product for Version 10.6.1).
    1. Starting with version 10.6.2, rule files are packaged in the plugin jar, so it is not necessary to set the root path to load rules with version 10.6.2+.

See https://docs.sonarqube.org/latest/setup/install-plugin/ for more details.

Setting the Root Path to the Parasoft Product for Version 10.6.1

  1. In the SonarQube web UI go to Administration > Configuration > General Settings > External Analyzers.
  2. Locate the Root Path setting under the appropriate programming language.
  3. In the field enter the absolute path to the Parasoft product installation and click Save.
  4. Restart the SonarQube server so that the rule definitions are loaded.
  5. After the server has restarted, go to Quality Profiles in the web UI and select the built-in Parasoft profile under the appropriate supported language. Verify that the rule definitions are loaded successfully under the profile.

If zero or only one rule is loaded, then loading of rules failed. In this case:

    1. Check that the root path is correct. 
    2. Review the SonarQube web server logs for any error messages.

Building Your Own Plugin

You can build your own plugin for your Parasoft products. To do so, you will need JDK 11+, Maven 3.3+, and your Parasoft products installed on the same machine.

  1. Clone the source code from GitHub found here: https://github.com/parasoft/parasoft-findings-sonar.
  2. Run a Maven package command that is appropriate for the Parasoft products you have installed. The example below includes Jtest, dotTEST, and C++Test; if you don't have one or more of these installed, remove its root path reference:

    mvn clean package -DjtestRootPath="<JTEST-INSTALL-ROOT-PATH>" -DdottestRootPath="<DOTTEST-INSTALL-ROOT-PATH>" -DcpptestRootPath="<CPPTEST-INSTALL-ROOT-PATH>"

    The plugin jar that is created will be in the <SOURCE-CODE-ROOT-PATH>/target folder and will include the rule files for your Parasoft product.

Activating Parasoft Profiles

There are two ways to enable the Parasoft profile for your projects: 

Setting the Report Path for Static Analysis and Test Execution Results

For Parasoft results to be uploaded, the path to the report files must be set. There are several ways to configure this. 

Enter the path to the report.xml file of your project. For example:

target/jtest/report.xml

You can add multiple paths, each in a separate field. When the Parasoft scanner runs, results will be loaded from each valid report file path.

Setting the Report Path for Coverage

For Parasoft results to be uploaded, the path to the report files must be set. There are several ways to configure this. 

Uploading Project Results

To upload Parasoft results for a project, first run the command which generates the report.xml file, and then run the usual Sonar scanner command. For example, with a Maven project setup using Jtest, a single command can be run from the root directory of your project:

mvn jtest:jtest sonar:sonar -Dsonar.projectKey=<project key> -Dsonar.host.url=<server url> -Dsonar.token=<login token>

See the documentation for your Parasoft product for details on how to run test cases and generate a test execution report:

See the documentation for your Parasoft product for details on how to run test cases and generate a coverage report:


See https://docs.sonarqube.org/latest/analysis/overview/ for details on how to run the Sonar scanner on projects using different build systems.

Viewing Static Analysis Results

After the results are uploaded, they can be viewed in the project in the Issues tab.

C/C++test Professional Report Settings

If you are generating static analysis reports with C/C++test Professional 2023.1 or earlier, make sure the Add absolute file paths to XML data option is enabled to show the issues if it is stored in the SonarQube project. You can enable this option on the command line by using the option -property report.contexts_details=true or by setting the report.contexts_details=true property in the settings file.

Viewing Test Execution Results

After the results are uploaded, in addition to SOAtest test execution results, they can be viewed in the project in the Overview tab.

For SOAtest test execution results, it can be viewed in the project in the Measures tab.

C/C++test Professional Unit Test Results

C/C++test reports for unit test results must be generated with the Overview of checked files and executed tests option enabled. You can enable this option on the command line by using the option -property report.contexts_details=true or by setting the report.contexts_details=true property in the settings file.

Starting with version 2024.1, you can also use the command line option -property report.additional.report.dir=<REPORT_DIR> when generating the reports and use reports generated in this directory.

Viewing Code Coverage Results

After the results are uploaded, they can be viewed in the project in the Overview tab.

C/C++test Professional Reports

Code coverage reports for C/C++test Professional are not supported for versions prior to 2024.1.

Starting with version 2024.1, you can also use the command line option -property report.additional.report.dir=<REPORT_DIR> when generating the reports and use reports generated in this directory.

Third-party Acknowledgments

The Parasoft Findings Plugin for SonarQube uses the following third-party software:

Apache Commons Codec

This software is used under an Apache License 2.0 with this notice.

Apache Commons Collections

This software is used under an Apache License 2.0 with this notice.

Apache HttpClient

This software is used under an Apache License 2.0 with this notice.

Apache HttpClient Fluent API

This software is used under an Apache License 2.0 with this notice.

Apache HttpClient Mime

This software is used under an Apache License 2.0 with this notice.

Apache HttpCore

This software is used under an Apache License 2.0 with this notice.

Dom4j

This software is used under a BSD License.

Jackson-annotations

This software is used under an Apache License 2.0 with this notice.

Jackson-core

This software is used under an Apache License 2.0 with this notice.

jackson-databind

This software is used under an Apache License 2.0 with this notice.

JRCS Diff

This software is used under a LGPL License.

Saxon-HE

This software is used under an MPL 2.0 license.

SLF4J API Module

This software is used under an MIT License.

xmlresolver

This software is used under an Apache License 2.0.

zip4j

This software is used under an Apache License 2.0 with this notice.