-
Notifications
You must be signed in to change notification settings - Fork 186
Closed
Description
Sometimes you have situations where you dynamically test things on several different tables.
Example: You have a bunch of tables and an archive-functionality for them and you want to test if the things you put into live-tables are removed from live-tables and present in archive-tables:
procedure test_data_existance( i_tableName varchar2 )
as
v_count_real integer;
v_count_archive integer;
begin
execute immediate 'select count(*) from ' || i_tablename || '' into v_count_real;
execute immediate 'select count(*) from ' || i_tablename || '_archive' into v_count_archive;
ut.expect( v_count_archive ).to_( equal(1) );
ut.expect( v_count_real ).to_( equal(0) );
end;
procedure test_ARCHIVE_DATA
as
begin
-- Arrange
-- insert several data into real-tables here
-- Act
package_to_test.archive_data();
-- Assert
test_data_existance('TABLE_A');
test_data_existance('TABLE_B');
test_data_existance('TABLE_C');
test_data_existance('TABLE_D');
end;
If something fails I have no clue for which of my dynamic tests it failed.
It would therefore be great to have the possibility to add a dynamic error message to the expect object. Maybe somthing like
ut.expect( <actual> ).to_( <matcher> ).raise_( <custom error message if fails> )