|
--%suite
|
Package is a test suite
|
|
--%suite(description)
|
A suite with description
|
|
--%suitepath(org.my_org.my_project)
|
Similar to Java package.
Groups suites in namespaces |
|
--%test
|
The procedure is a test
|
|
--%test(description)
|
A test with description
|
|
--%beforetest(procedure_name)
|
Runs the procedure before annotated test
|
|
--%aftertest(procedure_name)
|
Runs the procedure after annotated test
|
|
--%beforeall
|
The procedure to run before first test in suite
|
|
--%afterall
|
The procedure to run after last test in suite
|
|
--%beforeeach
|
The procedure to run before each test
|
|
--%aftereach
|
The procedure to after each test
|
|
be_empty
open l_cursor for select * from dual where 1 = 0;ut.expect( l_cursor ).to_( be_empty() );
|
|
be_false
ut.expect( ( 1 = 0 ) ).to_( be_false() );
|
|
be_not_null
ut.expect( to_clob('ABC') ).to_( be_not_null() );
|
|
be_null
ut.expect( 1 ).to_( be_null() );
|
|
be_true
ut.expect( ( 1 = 1 ) ).to_( be_true() );
|
|
--%disabled
|
Suite / test will not execute
|
|
--%rollback(auto)
|
|
|
--%rollback(manual)
|
No savepoint/rollback
|
|
Base expectation block
ut.expect( actual_value ).to_( matcher );
|
|
Negated expectation block
ut.expect( actual_value ).not_to( matcher );
|
|
Shortcuts to matchers
ut.expect( actual_value ).[not_]to_matcher;
|
|
equal
ut.expect( 'a dog' ).to_(a_nulls_are_equal is true by default |
|
equal with cursors
open l_expected for select * from dual;open l_actual for select * from dual where 1 = 0;ut.expect( l_expected ).to_(
|
|
equal on objects
ut.expect( anydata.convertObject(l_expected) ).to_(
|
|
equal on collections
ut.expect( anydata.convertCollection(l_expected) ).to_(
|
|
be_like
ut.expect( 'Lorem_impsum' ).to_( ut.expect( 'Lorem_impsum' ).to_( be_like( '%rem%sum' ) );a_mask, a_escape_char -> see Oracle like operator |
|
match
ut.expect( a_actual => '123-456-ABcd' ).to_( ut.expect( 'some value' ).to_( match( '^some.*' ) );a_pattern, a_modifiers -> see regexp_like function |
|
be_between
ut.expect( 3 ).to_( be_between( 1, 3 ) );
|
|
be_greater_or_equal
ut.expect( sysdate ).to_( be_greater_or_equal( sysdate - 1 ) );
|
|
be_greater_than
ut.expect( 2 ).to_( be_greater_than( 1 ) );
|
|
be_less_or_equal
ut.expect( 3 ).to_( be_less_or_equal( 3 ) );
|
|
be_less_than
exec ut.expect( 3 ).to_( be_less_than( 2 ) );
|
|
Color output
|
|
XUnit reporter
|
|
TeamCity reporter
|
|
Sonar Test reporter
|
|
Coverage html reporter
exec ut.run(ut_coverage_html_reporter());Produces HTML coverage report |
|
Run all unit tests in my current schema
exec ut.run();
|
|
Run all unit tests in current schema after it was changed to HR
alter session set current_schema='HR';exec ut.run();
|
|
Run all unit tests in specific schema
exec ut.run('HR');
|
|
Run all unit tests in specific package of current schema
exec ut.run('test_betwnstr');
|
|
Run all unit tests in specific schema.package
exec ut.run('hr.test_betwnstr');
|
|
Run one specific test only
exec ut.run('hr.test_betwnstr.big_end_position');
|
|
Run several items
exec ut.run(ut_varchar2_list(
|
|
Run test using suitepath
exec ut.run(':com.my_org.my_project');
|
|
Run the tests as a select statement
select * from table(ut.run());
|
procedure my_code_raises_zero_divisor is
l_my_number number;
begin
l_my_number := 1/0; *--should raise*
ut.fail('Expected exception but nothing was raised');
exception
when others then
ut.expect( sqlcode ).to_equal( -1476 );
end;
No comments yet.
Cheatography n. The art of mapping complex subjects into clear, instantly navigable reference guides.