Thanks to visit codestin.com
Credit goes to github.com

Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Adding COVERAGE_RUN_ID to the utPLSQL context to allow for more accur…
…ate coverage reporting when runnign tests against the coverage module of the framework.
  • Loading branch information
jgebal committed Feb 26, 2022
commit b8a3fb6c02e0e52dca57d608aab8f27647f0a62a
3 changes: 2 additions & 1 deletion docs/userguide/annotations.md
Original file line number Diff line number Diff line change
Expand Up @@ -2121,7 +2121,8 @@ It can be accessed from any procecure invoked as part of utPLSQL test execution.
> For example if utPLSQL is installed into `HR` schema, the context name will be `HR_INFO`

Following attributes are populated:
- Always:
- For entire duration of the test-run:
- `sys_context( 'UT3_INFO', 'COVERAGE_RUN_ID' );` - Value of COVERAGE_RUN_ID used by utPLSQL internally for coverage gathering
- `sys_context( 'UT3_INFO', 'RUN_PATHS' );` - list of suitepaths / suitenames used as input parameters for call to `ut.run(...)` or `ut_runner.run(...)`
- `sys_context( 'UT3_INFO', 'SUITE_DESCRIPTION' );` - the description of test suite that is currently being executed
- `sys_context( 'UT3_INFO', 'SUITE_PACKAGE' );` - the owner and name of test suite package that is currently being executed
Expand Down
2 changes: 2 additions & 0 deletions source/core/session_context/ut_session_info.tpb
Original file line number Diff line number Diff line change
Expand Up @@ -28,12 +28,14 @@ create or replace type body ut_session_info as
member procedure before_calling_run(self in out nocopy ut_session_info, a_run in ut_run) is
begin
ut_session_context.set_context( 'run_paths', ut_utils.to_string( ut_utils.table_to_clob( a_run.run_paths,',' ), null ) );
ut_session_context.set_context( 'coverage_run_id', rawtohex( a_run.coverage_options.coverage_run_id ) );
dbms_application_info.set_module( 'utPLSQL', null );
end;

member procedure after_calling_run(self in out nocopy ut_session_info, a_run in ut_run) is
begin
ut_session_context.clear_context( 'run_paths' );
ut_session_context.clear_context( 'coverage_run_id' );
dbms_application_info.set_module( module, action );
dbms_application_info.set_client_info( client_info );
end;
Expand Down
3 changes: 2 additions & 1 deletion test/ut3_user/api/test_ut_run.pkb
Original file line number Diff line number Diff line change
Expand Up @@ -1268,7 +1268,8 @@ Failures:%
procedure sys_ctx_on_suite_beforeall is
begin
ut.expect(g_context_test_results).to_be_like(
'%BEFORE_SUITE:CURRENT_EXECUTABLE_NAME='||gc_owner||'.check_context.before_suite'
'%BEFORE_SUITE:COVERAGE_RUN_ID=________________________________%'
||'%BEFORE_SUITE:CURRENT_EXECUTABLE_NAME='||gc_owner||'.check_context.before_suite'
||'%BEFORE_SUITE:CURRENT_EXECUTABLE_TYPE=beforeall'
||'%BEFORE_SUITE:RUN_PATHS=check_context'
||'%BEFORE_SUITE:SUITE_DESCRIPTION=Suite description'
Expand Down