|
| 1 | +--Shows how to create a test suite in code and call the test runner. |
| 2 | +--No tables are used for this. |
| 3 | +--Suite Management packages are when developed will make this easier. |
| 4 | +DECLARE |
| 5 | + testtoexecute ut_types.singletest; |
| 6 | + Suite UT_TYPES.TestSuite; |
| 7 | + TestResults ut_types.TestSuiteResults; |
| 8 | +BEGIN |
| 9 | + Suite.SuiteName := 'Test Suite Name'; |
| 10 | + Suite.Tests := ut_Types.TestList(); |
| 11 | + |
| 12 | + TestToExecute.TypeOfTest := ut_Types.TT_Package; |
| 13 | + TestToExecute.ObjectName := 'ut_exampletest'; |
| 14 | + TestToExecute.SetupMethod := 'Setup'; |
| 15 | + TestToExecute.TearDownMethod := 'TearDown'; |
| 16 | + TestToExecute.TestMethod := 'ut_exampletest'; |
| 17 | + |
| 18 | + Suite.Tests.Extend; |
| 19 | + Suite.Tests(Suite.Tests.LAST) := TestToExecute; |
| 20 | + / |
| 21 | + TestToExecute.TypeOfTest := ut3Types.TT_Package; |
| 22 | + TestToExecute.ObjectName := 'ut_exampletest2'; |
| 23 | + TestToExecute.SetupMethod := 'Setup'; |
| 24 | + TestToExecute.TearDownMethod := 'TearDown'; |
| 25 | + TestToExecute.TestMethod := 'ut_exampletest'; |
| 26 | + |
| 27 | + Suite.Tests.Extend; |
| 28 | + Suite.Tests(Suite.Tests.LAST) := TestToExecute; |
| 29 | + |
| 30 | + ut3TestRunner.ExecuteTests(Suite,null,TestResults); |
| 31 | + |
| 32 | + -- No reporter used in this example so outputing the results manually. |
| 33 | + FOR test_idx in TestResults.first .. TestResults.last |
| 34 | + LOOP |
| 35 | + dbms_output.put_line('---------------------------------------------------'); |
| 36 | + dbms_output.put_line('Test:' || TestResults(test_idx).Test.ObjectName || '.' || TestResults(test_idx).Test.TestMethod ); |
| 37 | + dbms_output.put_line('Result: ' || TestResults(test_idx).result); |
| 38 | + dbms_output.put_line('Assert Results:'); |
| 39 | + FOR I in TestResults(test_idx).AssertResults.First .. TestResults(test_idx).AssertResults.Last |
| 40 | + LOOP |
| 41 | + dbms_output.put_line(I || ' - result: ' || TestResults(test_idx).AssertResults(I).AssertResult); |
| 42 | + dbms_output.put_line(I || ' - Message: ' || TestResults(test_idx).AssertResults(I).Message); |
| 43 | + END LOOP; |
| 44 | + END LOOP; |
| 45 | + dbms_output.put_line('---------------------------------------------------'); |
| 46 | +END; |
| 47 | + |
| 48 | + |
| 49 | + |
| 50 | + |
| 51 | + |
| 52 | + |
0 commit comments