Qyerying for test suites¶
Obtaining information about suites¶
utPLSQL framework provides ability to read inforamtion about unit test suites that exist in a schema.
Pipelined table function ut_runner.get_suites_info(a_owner, a_package_name)
allows you to retrieve information about:
- all suites that exist in a given user/schema
- individual test suite pacakage
Querying the data from function provides the follwing details:
object_owner
- the owner of test suite packagesobject_name
- the name of test suite packageitem_name
- the name of suite/testitem_description
- the description of suite/suite itemitem_type
- the type of item (UT_SUITE/UT_SUITE_CONTEXT/UT_TEST/UT_LOGICAL_SUITE)item_line_no
- line_number where annotation identifying the item existspath
- suitepath of the itemdisabled_flag
- (0/1) indicator if item is disabled by --%disabled annotationtags
- tags associated with suites
To get list of all test suites in current schema
To get list of all tests for test suite TEST_STUFF
in current user schema
To get a full information about suite TEST_STUFF
including suite description, all contexts and tests in a suite
Checking if schema contains tests¶
Function ut_runner.has_suites(a_owner)
returns boolean value indicating if given schema contains test suites.
Example:
begin
if ut_runner.has_suites(USER) then
dbms_output.put_line( 'User '||USER||' owns test suites' );
else
dbms_output.put_line( 'User '||USER||' does not own test suites' );
end if;
end;
Checking if package is a test suite¶
Function ut_runner.is_suite(a_owner, a_package_name)
returns boolean value indicating if given package is a test suites.
Example:
begin
if ut_runner.is_suite(USER,'TEST_STUFF') then
dbms_output.put_line( 'Package '||USER||'.TEST_STUFF is a test suite' );
else
dbms_output.put_line( 'Package '||USER||'.TEST_STUFF is not a test suite' );
end if;
end;
Checking if procedure is a test within a suite¶
Function ut_runner.is_test(a_owner, a_package_name, a_procedure_name)
returns boolean value indicating if given package is a test suites.
Example:
begin
if ut_runner.is_test(USER,'TEST_STUFF','A_TEST_TO_CHECK_STUFF') then
dbms_output.put_line( 'Procedure '||USER||'.TEST_STUFF.A_TEST_TO_CHECK_STUFF is a test' );
else
dbms_output.put_line( 'Procedure '||USER||'.TEST_STUFF.A_TEST_TO_CHECK_STUFF is not a test' );
end if;
end;
Created: November 17, 2018 21:55:19