Toad World® Forums

Code coverage in Code Tester


A very persistent request we get is to add code coverage analysis to Code Tester.

This means that after running a test, you could find out which lines of code ran and did not run, and overall code coverage (% of lines of code exercised).

The way this happens in PL/SQL is that you use the DBMS_PROFILER to enable profiling. This way Oracle keeps track of each line executed and writes the information to pre-defined tables.

You then query the results out of these tables.

In 1.6.1, currently available as a beta on this site, we have added a PL/SQL API to enable profiling in Code Tester in your test definition.

For example, if you want to enable profiling of all test cases, simply put this call in the test definition initialization section:


and then after running the tests, you can run one or more queries (which we currently do NOT provide) to extract code coverage information.

You can find scripts online that will help with this. For example:

In a future release, we will add better UI and report support for this feature. But at least with 1.6.1, it is transparently easy to get the profile data from your tests.

See the Help doc for more details.