PLSQL code coverage

I’m trying to integrate PL/SQL code coverage into SonarQube using utPLSQL and the utPLSQL-cli on Windows 11.

I followed official examples to generate coverage.xml using the CLI:

.\utplsql.bat run system/{P/A/S/S/}@/localhost:1521/XEPDB1 -f=ut_coverage_sonar_reporter -o=coverage.xml --coverage-schemes=SYSTEM -p=SYSTEM

But it repeatedly throws errors like:

“Unmatched argument at index 4: ‘.xml’”

“Invalid value for option ‘-s’: ‘SYSTEM’ is not a boolean”

I tried various syntax fixes but haven’t been able to get a clean coverage.xml output.

Could you provide a confirmed working example for:

Windows 11 + PowerShell

Oracle XE (Docker)

utPLSQL-cli + SonarQube setup

It would be great if you can provide troubleshooting assistance too.

Thank you!

Hi,

In PowerShell, you need to wrap any argument values that include a dot (.) in double quotes or PowerShell can misinterpret them as property accessors.

This should work:

.\utplsql.bat run system/pass@//localhost:1521/XEPDB1 -f=ut_coverage_sonar_reporter -o="coverage.xml" --coverage-schemes=SYSTEM -p=SYSTEM

I say should because generating this report properly can be tricky. The PL/SQL support from SonarQube commercial builds doesn’t have any native support for utPLSQL coverage reports, so the coverage.xml file must include the actual file paths for your PL/SQL sources. That’s where things get complicated.

To make that work, utPLSQL-cli has a file-mapping config, but it can be very complex, or even impossible, depending on how your source files are organized.

Even the example from the utPLSQL project had an error and didn’t generate a valid report. The command arguments are overly complex. It could be much simpler:wink:

Hi,

Thanks again for the insights.

I tried the command you suggested, but it still didn’t work as expected. Given how tricky this setup is—especially with the file path mappings and the lack of native support in SonarQube’s commercial editions—I’m wondering how teams typically get this working reliably.

Do you happen to know if there’s a recommended or commonly used approach that produces a valid report? Or maybe an alternative tool or workflow that integrates more smoothly with SonarQube for PL/SQL code coverage?

Appreciate any pointers you can share.