|
2 | 2 | --No tables are used for this. |
3 | 3 | --Suite Management packages are when developed will make this easier. |
4 | 4 | Clear Screen |
5 | | -Set Serveroutput On Size Unlimited |
| 5 | +Set Serveroutput On Size Unlimited format truncated |
| 6 | +set echo off |
| 7 | +--install the example unit test packages |
| 8 | +@@ut_exampletest.pks |
| 9 | +@@ut_exampletest.pkb |
| 10 | +@@ut_exampletest2.pks |
| 11 | +@@ut_exampletest2.pkb |
6 | 12 |
|
7 | | -Declare |
8 | | - testtoexecute ut_types.single_test; |
9 | | - Suite Ut_Types.Test_Suite; |
10 | | - testresults ut_types.test_suite_results; |
11 | | -Begin |
12 | | - Suite.Suite_name := 'Test Suite Name'; |
13 | | - Suite.Tests := ut_Types.Test_List(); |
14 | | - |
15 | | - Testtoexecute.object_name := 'ut_exampletest'; |
16 | | - Testtoexecute.setup_procedure := 'Setup'; |
17 | | - TestToExecute.teardown_procedure := 'TearDown'; |
18 | | - TestToExecute.test_procedure := 'ut_exampletest'; |
| 13 | +declare |
| 14 | + suite ut_test_suite; |
| 15 | + testtoexecute ut_test; |
| 16 | + test_item ut_test; |
| 17 | +begin |
| 18 | + suite := ut_test_suite(a_suite_name => 'Test Suite Name' /*,a_items => ut_test_objects_list()*/); |
19 | 19 |
|
20 | | - Suite.Tests.Extend; |
21 | | - Suite.Tests(Suite.Tests.Last) := Testtoexecute; |
| 20 | + testtoexecute := ut_test(a_object_name => 'ut_exampletest' |
| 21 | + ,a_test_procedure => 'ut_exAmpletest' |
| 22 | + ,a_setup_procedure => 'Setup' |
| 23 | + ,a_teardown_procedure => 'tEardown'); |
22 | 24 |
|
23 | | - Testtoexecute.object_name := 'ut_exampletest2'; |
24 | | - Testtoexecute.setup_procedure := 'Setup'; |
25 | | - TestToExecute.teardown_procedure := 'TearDown'; |
26 | | - TestToExecute.test_procedure := 'ut_exampletest'; |
27 | | - |
28 | | - Suite.Tests.Extend; |
29 | | - Suite.Tests(Suite.Tests.LAST) := TestToExecute; |
| 25 | + suite.add_item(testtoexecute); |
30 | 26 |
|
31 | | - ut_Test_Runner.Execute_Tests(Suite,null,TestResults); |
32 | | - |
33 | | - -- No reporter used in this example so outputing the results manually. |
34 | | - FOR test_idx in TestResults.first .. TestResults.last |
35 | | - LOOP |
36 | | - Dbms_Output.Put_Line('---------------------------------------------------'); |
37 | | - Dbms_Output.Put_Line('Test:' || Testresults(Test_Idx).Test.Object_Name || '.' || Testresults(Test_Idx).Test.Test_Procedure ); |
38 | | - dbms_output.put_line('Result: ' || Ut_Types.Test_Result_To_Char(TestResults(test_idx).result) ); |
39 | | - Dbms_Output.Put_Line('Assert Results:'); |
40 | | - FOR I in TestResults(test_idx).Assert_Results.First .. TestResults(test_idx).Assert_Results.Last |
41 | | - Loop |
42 | | - Dbms_Output.Put_Line(I || ' - result: ' || Ut_Types.Test_Result_To_Char(Testresults(Test_Idx).Assert_Results(I).Result) ); |
43 | | - dbms_output.put_line(I || ' - Message: ' || TestResults(test_idx).Assert_Results(I).Message); |
44 | | - END LOOP; |
45 | | - END LOOP; |
46 | | - dbms_output.put_line('---------------------------------------------------'); |
47 | | -End; |
48 | | -/ |
| 27 | + testtoexecute := ut_test(a_object_name => 'UT_EXAMPLETEST2' |
| 28 | + ,a_test_procedure => 'UT_EXAMPLETEST' |
| 29 | + ,a_setup_procedure => 'SETUP' |
| 30 | + ,a_teardown_procedure => 'TEARDOWN'); |
| 31 | + |
| 32 | + suite.add_item(testtoexecute); |
| 33 | + suite.execute; |
49 | 34 |
|
| 35 | + -- No reporter used in this example so outputing the results manually. |
| 36 | + for test_idx in suite.items.first .. suite.items.last loop |
| 37 | + test_item := treat(suite.items(test_idx) as ut_test); |
| 38 | + dbms_output.put_line('---------------------------------------------------'); |
| 39 | + dbms_output.put_line('Test:' || test_item.call_params.object_name || '.' || test_item.call_params.test_procedure); |
| 40 | + dbms_output.put_line('Result: ' || test_item.execution_result.result_to_char); |
| 41 | + dbms_output.put_line('Assert Results:'); |
| 42 | + for i in test_item.assert_results.first .. test_item.assert_results.last loop |
| 43 | + dbms_output.put_line(i || ' - result: ' || test_item.assert_results(i).result_to_char); |
| 44 | + dbms_output.put_line(i || ' - Message: ' || test_item.assert_results(i).message); |
| 45 | + end loop; |
| 46 | + end loop; |
| 47 | + dbms_output.put_line('---------------------------------------------------'); |
| 48 | +end; |
| 49 | +/ |
0 commit comments