Toad World® Forums

code coverage allways 0,00


#1

I’m trying to get results with de code coverage feature for my unit tests.
Unfortanally the results are always 0.
When creating a report I allway get the messages:

'No code coverage/profile data exists for

Code coverage data is gathered only when requested explicitly by checking
the “Gather code coverage data” checkbox found in the Test Editor Properties
page for your test definition. You can also set this attribute at the unit
test and test case levels if you want to gather code coverage information
for a subset of all of your tests.’

The profiler tables with public synonyms are created and I granted ALL on the table to public.

I checked the ‘Gather Code Coverage data’ option in the ‘test definition’.
I checked the ‘Gather Code Coverage data’ option the Unittest definition and set the percentage to 75.
On the unittest tab Customization in the section – Initialization for this unit test, I put the statement ‘qu_result_xp.profile_this_unit_test ;’

After running the unit test the ‘Last actual code coverage (%)’ is still 0,00
What did I mis to get the % of code coverage ??

Dirk


#2

Hello,
Can you check if “test” user has permission for these table (plsql_profiler_data, plsql_profiler_units, plsql_profiler_runs)?

example:
select * from plsql_profiler_data;

/Danny


#3

Also do the following:

  1. REMOVE the call to qu_result_xp.profile_this_unit_test - that was
    needed BEFORE we added the “Gather code coveraga data” checkbox.
    Shouldn’t interfere, but let’s make sure.

  2. Check the contents of the PLSQL profiler tables. Do they have data?

Finally, if you are still seeing nothing you can take these steps:

  1. Turn on trace (click on system icon in top left corner and choose
    Start Trace) and set the filter to “archive_profiling_data”
  2. Run your test.
  3. Extract contents of qu_log table as insert statements and send to
    steven.feuerstein@quest.com; we can then analyze the trace, perhaps
    get a sense of what is going on.

Cheers, SF


#4

Just as you asked I removed the call qu_result_xp.profile_this_unit_test.

After re-running the unittest I checked the three profiler tables and they contain data about my unit test.

When checking the screen I still see Last actual code coverage (%): 0,00 .

I’ll mail the insert statements of the qu_log table.

Thanks in advance


#5

The problem is solved, the solution was found in the answer of FAQ 34

'Assuming you have done this, then check to see if the program being tested and executed is owned by a schema (let’s call it CODE_SCHEMA) different from that in which you are currently connected (the TEST_SCHEMA). If this is the case, Oracle requires that TEST_SCHEMA not only has execute authority on that program, but also has “create procedure” authority on CODE_SCHEMA. To get your code coverage data, ask your DBA to grant CREATE ANY PROCEDURE to TEST_SCHEMA. ’

The onlything what was missing was the CREATE ANY PROCEDURE.
After granting there was a coverage %


#6

Hi DirkPeter,

Could you please tell me how your code coverage issue has been resolved ? Please though its too late to ask you this question but still please reply.