Description
Describe the bug
Hi Jacek and team. This is more a question than a bug
I am trying to speed up the test runs by running different UT packages in parallel sessions using DBMS_PARALLEL
Let's assume that different UT packages inside one UT suite are completely independent and do not interfere with each other.
As a POC I running 2 UT packages in 2 DBMS_PARALLEL jobs. Both runs go to success, all tests are passing.
The problem I am facing, I can't get the proper code coverage report for both packages (see Expected behavior)
Looks like I am missing something important in how code coverage works in UT PL/SQL. Could you please give me some guidence here.
Provide version info
Oracle Database 19c Enterprise Edition Release 19.0.0.0.0
UT PL/SQL: v3.1.14.4197
port_string: x86_64/Linux 2.4.xx
Information about client software
PLSQL Developer 14
Expected behavior
I am trying to follow the steps described here
https://www.utplsql.org/utPLSQL/latest/userguide/coverage.html#reporting-coverage-outside-utplsql-and-in-parallel-sessions
Creating one coverage_run_id and starting and stopping coverage manually inside each session/job
And at the end I am expecting the coverage report available for that coverage_run_id, but all the reports give me 0 lines coverage.
To get the report I use
select *
from table(
ut_coverage_html_reporter().get_report(
a_coverage_options => ut_coverage_options(
coverage_run_id => 'coverage_run_id',
schema_names => ut_varchar2_rows('schema for UT packages'),
include_objects => ut_varchar2_rows('one of the 2 UT packages i am tesing')
)
)
)
One insteresting observation.
As far as I understand, code coverage in UTs is based on DBMS_PROFILER.
But after I run the tests I don't see any traces of profiler been executed.
Example code
Here is a sample of a proc that is getting invoked inside each DBMS_PARALLEL session
PROCEDURE RUN_TEST(p_start_id NUMBER, p_end_id NUMBER) IS
l_coverage_run_id raw(32);
reporter ut_reporter_base := NULL;
reporters ut_reporters;
BEGIN
reporter := ut_documentation_reporter();
reporters := ut_reporters(reporter);
FOR CR IN (SELECT OWNER, PACAKGE_NAME, APP_USERID FROM UT_PACKAGE_LIST WHERE CHUNK_ID =p_start_id)
LOOP
l_coverage_run_id := '38EFCA8B43CC9697E06332A2BD0A1737';
ut_runner.coverage_start(l_coverage_run_id);
ut_runner.run(a_paths => ut_varchar2_list(CR.OWNER||'.'||CR.PACAKGE_NAME),
a_reporters => reporters
);
--ut.run(CR.OWNER||'.'||CR.PACAKGE_NAME);
ut_runner.coverage_stop();
dbms_output.put_line('Package: '||CR.PACAKGE_NAME||' Chunk:'||p_start_id);
treat(reporter as ut_output_reporter_base).lines_to_dbms_output();
SAVE_OUTPUT(CR.PACAKGE_NAME);
END LOOP;
COMMIT;
END;