forked from utPLSQL/utPLSQL
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathut_run.tpb
More file actions
112 lines (91 loc) · 3.61 KB
/
ut_run.tpb
File metadata and controls
112 lines (91 loc) · 3.61 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
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
create or replace type body ut_run as
/*
utPLSQL - Version 3
Copyright 2016 - 2021 utPLSQL Project
Licensed under the Apache License, Version 2.0 (the "License"):
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
constructor function ut_run(
self in out nocopy ut_run,
a_items ut_suite_items := null,
a_run_paths ut_varchar2_list := null,
a_coverage_options ut_coverage_options := null,
a_test_file_mappings ut_file_mappings := null,
a_client_character_set varchar2 := null,
a_random_test_order_seed positive := null,
a_run_tags ut_varchar2_rows := null
) return self as result is
begin
self.run_paths := a_run_paths;
self.run_tags := a_run_tags;
self.self_type := $$plsql_unit;
self.items := a_items;
self.client_character_set := lower(a_client_character_set);
self.random_test_order_seed := a_random_test_order_seed;
self.results_count := ut_results_counter();
self.test_file_mappings := coalesce(a_test_file_mappings, ut_file_mappings());
self.coverage_options := a_coverage_options;
return;
end;
overriding member procedure mark_as_skipped(self in out nocopy ut_run,a_skip_reason in varchar2) is
begin
null;
end;
overriding member function do_execute(self in out nocopy ut_run) return boolean is
l_completed_without_errors boolean;
begin
ut_utils.debug_log('ut_run.execute');
ut_event_manager.trigger_event(ut_event_manager.gc_before_run, self);
self.start_time := current_timestamp;
-- clear anything that might stay in the session's cache
ut_expectation_processor.clear_expectations;
for i in 1 .. self.items.count loop
l_completed_without_errors := self.items(i).do_execute();
end loop;
self.calc_execution_result();
self.end_time := current_timestamp;
ut_event_manager.trigger_event(ut_event_manager.gc_after_run, self);
return l_completed_without_errors;
end;
overriding member procedure set_rollback_type(self in out nocopy ut_run, a_rollback_type integer, a_force boolean := false) is
begin
self.rollback_type := case when a_force then a_rollback_type else coalesce(self.rollback_type, a_rollback_type) end;
for i in 1 .. self.items.count loop
self.items(i).set_rollback_type(self.rollback_type, a_force);
end loop;
end;
overriding member procedure calc_execution_result(self in out nocopy ut_run) is
l_result integer(1);
begin
if self.items is not null and self.items.count > 0 then
for i in 1 .. self.items.count loop
self.results_count.sum_counter_values( self.items(i).results_count );
end loop;
l_result := self.results_count.result_status();
else
--if suite is empty then it's successful (no errors)
l_result := ut_utils.gc_success;
end if;
self.result := l_result;
end;
overriding member procedure mark_as_errored(self in out nocopy ut_run, a_error_stack_trace varchar2) is
begin
null;
end;
overriding member function get_error_stack_traces return ut_varchar2_list is
begin
return ut_varchar2_list();
end;
overriding member function get_serveroutputs return clob is
begin
return null;
end;
end;
/