In this section:
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:
parasoft.findings.sonar-<VERSION>.jar
.parasoft.findings.sonar-2023.1.jar
.extensions/plugins
directory.See https://docs.sonarqube.org/latest/setup/install-plugin/ for more details.
If zero or only one rule is loaded, then loading of rules failed. In this case:
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.
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.
There are two ways to enable the Parasoft profile for your projects:
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.
Jtest using Maven:
mvn sonar:sonar -Dsonar.token=<your sonar token> -Dsonar.host.url="http://<your sonar server>:<your sonar server port>/" -Dsonar.parasoft.jtest.reportPaths=target/report.xml...<additional sonar settings> |
Jtest using sonar-scanner:
sonar-scanner-<version>-windows/bin/sonar-scanner.bat -Dsonar.token=<your sonar token> -Dsonar.host.url="http://<your sonar server>:<your sonar server port>/" -Dsonar.parasoft.jtest.reportPaths=target/report.xml...<additional sonar settings> |
C/C++test using sonar-scanner:
build-wrapper-win-x86-64.exe --out-dir build_wrapper_output_directory...<your build commands i.e.: make clean all "C:/cpptest/examples/FlowAnalysisCpp"> |
sonar-scanner-<version>-windows/bin/sonar-scanner.bat -Dsonar.token=<your sonar token> -Dsonar.host.url="http://<your sonar server>:<your sonar server port>/" -Dsonar.parasoft.cpptest.reportPaths=target/report.xml...<additional sonar settings> |
dotTEST using .NET's sonar-scanner (Note: Sonar-scanner must be installed via the command: dotnet tool install --global dotnet-sonarscanner
):
dotnet sonarscanner begin /k:"<your solution>" /d:sonar.token="<your sonar token>" /d:sonar.parasoft.dottest.reportPaths="target/report.xml"...<additional sonar settings> |
dotnet build <your solution> |
dotnet sonarscanner end /d:sonar.token="<your sonar token>" |
dotTEST using Sonar's provided sonar-scanner:
sonar-scanner-<version>-windows/bin/sonar-scanner.bat -Dsonar.token=<your sonar token> -Dsonar.host.url="http://<your sonar server>:<your sonar server port>/" -Dsonar.parasoft.dottest.reportPaths=target/report.xml...<additional sonar settings> |
sonar-scanner-<version>-windows/bin/sonar-scanner.bat -Dsonar.token=<your sonar token> -Dsonar.host.url="http://<your sonar server>:<your sonar server port>/" -Dsonar.parasoft.soatest.reportPaths=target/report.xml...<additional sonar settings> |
You can include multiple report files:
mvn sonar:sonar -Dsonar.parasoft.jtest.reportPaths=target/report.xml -Dsonar.parasoft.jtest.reportPaths=target/report_2.xml...<additional sonar settings> |
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:
report/coverage.xml
or
D:\project\report\coverage.xml
Jtest using Maven:
mvn sonar:sonar -Dsonar.token=<your sonar key> -Dsonar.host.url="http://<your sonar server>:<your sonar server port>/" -Dsonar.parasoft.coverage.reportPaths=target/coverage.xml...<additional sonar settings> |
Jtest using sonar-scanner:
sonar-scanner-<version>-windows/bin/sonar-scanner.bat -Dsonar.token=<your sonar key> -Dsonar.host.url="http://<your sonar server>:<your sonar server port>/" -Dsonar.parasoft.coverage.reportPaths=target/coverage.xml...<additional sonar settings> |
C/C++test using sonar-scanner:
build-wrapper-win-x86-64.exe --out-dir build_wrapper_output_directory...<your build commands i.e.: make clean all "C:/cpptest/examples/FlowAnalysisCpp"> |
sonar-scanner-<version>-windows/bin/sonar-scanner.bat -Dsonar.token=<your sonar key> -Dsonar.host.url="http://<your sonar server>:<your sonar server port>/" -Dsonar.parasoft.coverage.reportPaths=target/coverage.xml...<additional sonar settings> |
dotTEST using .NET's sonar-scanner (Note: Sonar-scanner must be installed via the command: dotnet tool install --global dotnet-sonarscanner
):
dotnet sonarscanner begin /k:"<your solution>" /d:sonar.token="<your sonar key>" /d:sonar.parasoft.coverage.reportPaths="target/coverage.xml"...<additional sonar settings> |
dotnet build <your solution> |
dotnet sonarscanner end /d:sonar.token="<your sonar key>" |
dotTEST using Sonar's provided sonar-scanner:
sonar-scanner-<version>-windows/bin/sonar-scanner.bat -Dsonar.token=<your sonar key> -Dsonar.host.url="http://<your sonar server>:<your sonar server port>/" -Dsonar.parasoft.coverage.reportPaths=target/coverage.xml...<additional sonar settings> |
sonar-scanner-<version>-windows/bin/sonar-scanner.bat -Dsonar.token=<your sonar key> -Dsonar.host.url="http://<your sonar server>:<your sonar server port>/" -Dsonar.parasoft.soatest.reportPaths=target/report.xml...<additional sonar settings> |
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.
After the results are uploaded, they can be viewed in the project in the Issues tab.
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.
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 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.
After the results are uploaded, they can be viewed in the project in the Overview tab.
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.
The Parasoft Findings Plugin for SonarQube uses the following third-party software:
This software is used under an Apache License 2.0 with this notice.
This software is used under an Apache License 2.0 with this notice.
This software is used under an Apache License 2.0 with this notice.
This software is used under an Apache License 2.0 with this notice.
This software is used under an Apache License 2.0 with this notice.
This software is used under an Apache License 2.0 with this notice.
This software is used under a BSD License.
This software is used under an Apache License 2.0 with this notice.
This software is used under an Apache License 2.0 with this notice.
This software is used under an Apache License 2.0 with this notice.
This software is used under a LGPL License.
This software is used under an MPL 2.0 license.
This software is used under an MIT License.
This software is used under an Apache License 2.0.
This software is used under an Apache License 2.0 with this notice.