GeezerVison is showing github.com — Exclude set of Procs From Code Coverage report · utPLSQL/utPLSQL · Discussion #1348
Exclude set of Procs From Code Coverage report
#1348
Discussion options
-
Uh oh!
There was an error while loading. Please reload this page.
|
Describe the bug
I have package that has 11 functions .
I am trying to get the sonar coverage report for this and when I run
When I run the below command I am getting the coverage report all on the lines one code. I only wrote test cases for 2 procs and sonar report is showing 2.5% coverage
utplsql run -c "apps/****@db" -p="apps.TEST_XXGCO_BRIDGE_SAAS_INTG_PKG" -f=ut_coverage_sonar_reporter -o="utplsql_coverage.xml" --coverage-schemes=APPS -include=APPS.XXGCO_BRIDGE_SAAS_INTG_PKG
I am trying to exclude the other procs except the two procs that i wrote test cases. I tried to exclude one proc with following command
utplsql run -c "apps/****@db" -p="apps.TEST_XXGCO_BRIDGE_SAAS_INTG_PKG" -f=ut_coverage_sonar_reporter -o="utplsql_coverage.xml" --coverage-schemes=APPS -include=APPS.XXGCO_BRIDGE_SAAS_INTG_PKG -exclude=APPS.XXGCO_BRIDGE_SAAS_INTG_PKG.PROCESS_SALES_ORDER_EXTRACT
But it is giving me blank coverage report like below
Provide version info
Running on utPLSQL v3.1.14.4197
utPLSQL-cli 3.1.9.local
utPLSQL-java-api 3.1.9.local
Java-Version: 1.8.0_431
ORACLE_HOME: null
NLS_LANG: null
Thanks for testing!
**Information about client software**
What client was used to run utPLSQL tests? Was it from TOAD, SQLDeveloper, SQLPlus, PLSQL Developer etc...
**To Reproduce**
Steps to reproduce the behavior:
1. Go to '...'
2. Click on '....'
3. Scroll down to '....'
4. See error
**Expected behavior**
A clear and concise description of what you expected to happen.
**Example code**
If applicable, add sample code to help explain your problem.
Please avoid putting your company private/protected code in an issue, as it might violate your company's privacy and security policies.
**Additional context**
Add any other context about the problem here.
|
You must be logged in to vote
Comment options
-
Uh oh!
There was an error while loading. Please reload this page.
|
Hello @ntubati
The code coverage is a metric that indicates the percentage of code that is executed during a test run.
You can read more about this for example here.
utPLSQL provides line coverage and a block coverage (branches per line of code).
The coverage is calculated at the level of compiled unit of code (package/procedure/function./trigger).
It is not possible to exclude/include individual functions of a single package from a coverage report.
That would also be very much confusing as the percentage of coverage is presented for the whole compiled program unit (package) not for the fragments of that program unit.
I am not sure what is the goal that you are trying to achieve.
In my opinion, since the coverage report says that 2.5% of code is covered with tests, than it is clear that the remaining part is not tested.
This is perfect as it allows you to see the progress of coverage increasing as you write tests to cover the rest of the functionality of the package.
|
You must be logged in to vote
0 replies
Comment options
-
Uh oh!
There was an error while loading. Please reload this page.
|
Thanks for the detailed reply. We have never done unit testing cover for PLSQL in our application and we have lot of legacy code. we are planning to start using this and doing a poc. One of the ask is to see how we can calculate the code coverage only for incremental code not for the legacy code. I guess in this case first we have to upload as is code coverage which will show 0 and then look for coverage for incremental code.
Ba based on what you explained , if i have custom package procedure which calls the standard oracle procedure , I can't exclude it from coverage report , but i can exclude it from testing?
|
You must be logged in to vote
0 replies
Comment options
-
Uh oh!
There was an error while loading. Please reload this page.
|
You can exclude separate units of compiled code.
So you can exclude packages, standalone procedures and standalone functions.
I suspect that you do not change oracle supplied packages by adding your custom code into their program units.
If you do I would be very concerned.
So you should be able to exclude program units that you do not own and only measure coverage on program units that you own and are responsible for.
I hope this answers your questions.
|
You must be logged in to vote
0 replies
Converted from issue
This discussion was converted from issue #1302 on May 09, 2026 18:41.