forked from utPLSQL/utPLSQL
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathRunExampleTestSuite.sql
More file actions
58 lines (52 loc) · 2.17 KB
/
Copy pathRunExampleTestSuite.sql
File metadata and controls
58 lines (52 loc) · 2.17 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
--Shows how to create a test suite in code and call the test runner.
--No tables are used for this.
--Suite Management packages are when developed will make this easier.
--Clear Screen
Set Serveroutput On Size Unlimited format truncated
set echo off
--install the example unit test packages
@@ut_exampletest.pks
@@ut_exampletest.pkb
@@ut_exampletest2.pks
@@ut_exampletest2.pkb
declare
suite ut_logical_suite;
listener ut_event_listener := ut_event_listener(ut_reporters());
test_item ut_test;
expectation ut_expectation_result;
begin
suite := ut_logical_suite(a_object_owner=>null, a_object_name => 'ut_exampletest', a_name => null, a_description => 'Test Suite Name',a_path => null);
suite.add_item(
ut_test(a_object_name => 'ut_exampletest'
,a_name => 'ut_exAmpletest'
,a_description => 'Example test1'
,a_before_test_proc_name => 'Setup'
,a_after_test_proc_name => 'tEardown')
);
suite.add_item(
ut_test(
a_object_name => 'UT_EXAMPLETEST2',
a_name => 'UT_EXAMPLETEST',
a_description => 'Another example test',
a_before_test_proc_name => 'SETUP',
a_after_test_proc_name => 'TEARDOWN')
);
suite.do_execute(listener);
-- No reporter used in this example so outputing the results manually.
for test_idx in suite.items.first .. suite.items.last loop
test_item := treat(suite.items(test_idx) as ut_test);
dbms_output.put_line('---------------------------------------------------');
dbms_output.put_line('Test:' || test_item.item.form_name);
dbms_output.put_line('Result: ' || ut_utils.test_result_to_char(test_item.result));
dbms_output.put_line('expectation Results:');
for i in test_item.results.first .. test_item.results.last loop
expectation := test_item.results(i);
dbms_output.put_line(i || ' - result: ' || ut_utils.test_result_to_char(expectation.result));
dbms_output.put_line(i || ' - Message: ' || expectation.message);
end loop;
end loop;
dbms_output.put_line('---------------------------------------------------');
end;
/
drop package ut_exampletest;
drop package ut_exampletest2;