Skip to Main Content

SQL Developer

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Sql Developer Unit Test- Gather Code Coverage Statistics

Narmada TMar 9 2018 — edited Mar 15 2018

I am using Sql Developer Unit Test framework to create unit test cases and test suites for my development. I was able to successfully create the repository , run the test cases and able to see the reports. Only problem i am facing is with Gather Code coverage Statistics.

When i check this check box and run the test case it should ideally gather the stats and populate UT_TEST_COVERAGE_STATS table and also the reports "Suite Runs Code Coverage" and "Test Runs Code Coverage" should show up the statistics of my test cases and test suites. But all these are blank. There is no data in UT_TEST_COVERAGE_STATS table. Also there is no error while running the tests and the results tab of test case/test suite shows the details like Coverage Run On - 'Date'. I want to know if i am missing any permissions to run the stats or any additional setup is required to get the coverage statistics.

Comments

We use the pl/sql profiler to get code coverage stats. Try observing the sql going across the wire in the View > Log > Statements panel for insight for what might be going wrong in your scenario.

Narmada T

Thank you so much for your response JeffSmith. Here is the error I could see in log

Error : "java.sql.SQLSyntaxErrorException: ORA-00904: : invalid identifier

" building UT_TEST_COVERAGE_STATS_PK, executing sql:

SELECT /*OracleDictionaryQueries.ALL_INDEX_METADATA_QUERY*/

       SYS.DBMS_METADATA.GET_XML('INDEX', ?, ?) XML

FROM   SYS.DUAL

thatJeffSmith-Oracle

I would open a service request with My Oracle Support - include those details. Also, be sure to tell them your version of oracle DB.

Narmada T

I think the issue here is access/privileges to run this query

SELECT /*OracleDictionaryQueries.ALL_INDEX_METADATA_QUERY*/

       SYS.DBMS_METADATA.GET_XML('INDEX', ?, ?) XML

FROM   SYS.DUAL.

SYS.DBMS_METADATA.GET_XML requires SELECT_CATALOGUE role. When i run this query alone  SELECT DBMS_METADATA.GET_XML('TABLE','EMP','SCOTT')FROM DUAL; on my Unit Test Repo schema, i get Invalid Identifier error.

The same query on schema that has select_Catalogue role runs successfully and returns the xml. So i have to try giving SELECT_CATALOGUE role to Unit test repo schema and try to gather statistics to test if that works.

1 - 4
Locked Post
New comments cannot be posted to this locked post.

Post Details

Locked on Apr 12 2018
Added on Mar 9 2018
4 comments
464 views