Skip to content

Commit b8a3fb6

Browse files
committed
Adding COVERAGE_RUN_ID to the utPLSQL context to allow for more accurate coverage reporting when runnign tests against the coverage module of the framework.
1 parent 9f229b8 commit b8a3fb6

File tree

3 files changed

+6
-2
lines changed

3 files changed

+6
-2
lines changed

docs/userguide/annotations.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2121,7 +2121,8 @@ It can be accessed from any procecure invoked as part of utPLSQL test execution.
21212121
> For example if utPLSQL is installed into `HR` schema, the context name will be `HR_INFO`
21222122
21232123
Following attributes are populated:
2124-
- Always:
2124+
- For entire duration of the test-run:
2125+
- `sys_context( 'UT3_INFO', 'COVERAGE_RUN_ID' );` - Value of COVERAGE_RUN_ID used by utPLSQL internally for coverage gathering
21252126
- `sys_context( 'UT3_INFO', 'RUN_PATHS' );` - list of suitepaths / suitenames used as input parameters for call to `ut.run(...)` or `ut_runner.run(...)`
21262127
- `sys_context( 'UT3_INFO', 'SUITE_DESCRIPTION' );` - the description of test suite that is currently being executed
21272128
- `sys_context( 'UT3_INFO', 'SUITE_PACKAGE' );` - the owner and name of test suite package that is currently being executed

source/core/session_context/ut_session_info.tpb

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,12 +28,14 @@ create or replace type body ut_session_info as
2828
member procedure before_calling_run(self in out nocopy ut_session_info, a_run in ut_run) is
2929
begin
3030
ut_session_context.set_context( 'run_paths', ut_utils.to_string( ut_utils.table_to_clob( a_run.run_paths,',' ), null ) );
31+
ut_session_context.set_context( 'coverage_run_id', rawtohex( a_run.coverage_options.coverage_run_id ) );
3132
dbms_application_info.set_module( 'utPLSQL', null );
3233
end;
3334

3435
member procedure after_calling_run(self in out nocopy ut_session_info, a_run in ut_run) is
3536
begin
3637
ut_session_context.clear_context( 'run_paths' );
38+
ut_session_context.clear_context( 'coverage_run_id' );
3739
dbms_application_info.set_module( module, action );
3840
dbms_application_info.set_client_info( client_info );
3941
end;

test/ut3_user/api/test_ut_run.pkb

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1268,7 +1268,8 @@ Failures:%
12681268
procedure sys_ctx_on_suite_beforeall is
12691269
begin
12701270
ut.expect(g_context_test_results).to_be_like(
1271-
'%BEFORE_SUITE:CURRENT_EXECUTABLE_NAME='||gc_owner||'.check_context.before_suite'
1271+
'%BEFORE_SUITE:COVERAGE_RUN_ID=________________________________%'
1272+
||'%BEFORE_SUITE:CURRENT_EXECUTABLE_NAME='||gc_owner||'.check_context.before_suite'
12721273
||'%BEFORE_SUITE:CURRENT_EXECUTABLE_TYPE=beforeall'
12731274
||'%BEFORE_SUITE:RUN_PATHS=check_context'
12741275
||'%BEFORE_SUITE:SUITE_DESCRIPTION=Suite description'

0 commit comments

Comments
 (0)