Toad World® Forums

Need Code Coverage data for Complete Package


#1

Hi All,

I have created some test cases for the procedures and functions of a package. I have enabled the “Gather Code Coverage data” option for the package and also for the sub programs(procedures and functions). On execution of the test cases, I can see the code coverage for each and every procedures and functions of the package. But the data is specific to the procedure or function.

Is there any way I can get the complete code coverage data for the whole package based on all the test cases for the member procedures and functions.

Regards,

Ranatosh


#2

Hi All,

We are stuck in this matter. Any help would be greatly appreciated.

Regards,

Ranatosh


#3

Hi Ranatosh,

the Code Tester repository table QU_CODE_COVERAGE_HDR contains overall data of Code Coverage. You’d need to run a SQL select on that table which will gather the statistics you need.

I’ll use an example SQL select where I have one test definition for my package containing 3 tested functions, having several test cases for each of the functions.

As you can see, there is a harness_guid identifier needed for the select statement. You can get your actual identifier when inspecting the Test definition properties in Code Tester Test explorer.

I got three results that are corresponding to the three functions from the package. Depending on your needs, you may sum up the total code coverage using different methods. In my case, when I compute the sum of the three lines_executed, I get 4+7+6=17 lines executed from the 17 lines total. So it looks like 100% coverage. Of course, my package is pretty simple and the tests are created from the Code Tester Run window, ensuring the code is executed, so it is looking nice.

LINES_EXECUTED

LINES_TOTAL

CODE_COVERAGE_ACTUAL

4

17

23.53

7

17

41.18

6

17

35.29

I’m attaching the testing package source code to this answer for you so you can verify my results as well.

Best regards,

Ferdinand
PKG_CODE_COVERAGE_SUM.sql (860 Bytes)


#4

So the example select statement did not appear… Let’s try again

SELECT LINES_EXECUTED, LINES_TOTAL, CODE_COVERAGE_ACTUAL FROM QU_CODE_COVERAGE_HDR coverages, (SELECT * FROM QU_UNIT_TEST WHERE QU_UNIT_TEST.HARNESS_GUID = '{6A998F0E-A847-7331-E053-0502000AE1C4}') units WHERE coverages.UNIT_TEST_GUID = units.UNIVERSAL_ID