@@ -2,13 +2,13 @@ create or replace type body ut_teamcity_reporter is
22 /*
33 utPLSQL - Version X.X.X.X
44 Copyright 2016 - 2017 utPLSQL Project
5-
5+
66 Licensed under the Apache License, Version 2.0 (the "License"):
77 you may not use this file except in compliance with the License.
88 You may obtain a copy of the License at
9-
9+
1010 http://www.apache.org/licenses/LICENSE-2.0
11-
11+
1212 Unless required by applicable law or agreed to in writing, software
1313 distributed under the License is distributed on an "AS IS" BASIS,
1414 WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -39,68 +39,52 @@ create or replace type body ut_teamcity_reporter is
3939 overriding member procedure before_calling_test(self in out nocopy ut_teamcity_reporter, a_test in ut_test) is
4040 l_test_full_name varchar2(4000);
4141 begin
42-
42+
4343 l_test_full_name := lower(a_test.item.owner_name) || '.' || lower(a_test.item.object_name) || '.' ||
4444 lower(a_test.item.procedure_name);
45-
45+
4646 self.print_text(ut_teamcity_reporter_helper.test_started(a_test_name => l_test_full_name
4747 ,a_capture_standard_output => true));
48-
48+
4949 end;
5050
5151 overriding member procedure after_calling_test(self in out nocopy ut_teamcity_reporter, a_test in ut_test) is
5252 l_assert ut_assert_result;
5353 l_test_full_name varchar2(4000);
5454 l_std_err_msg varchar2(32767);
55- procedure print_output(a_exectable ut_executable) is
56- l_lines ut_varchar2_list;
57- begin
58- if a_exectable is not null and a_exectable.is_defined and a_exectable.serveroutput is not null and
59- dbms_lob.getlength(a_exectable.serveroutput) > 0 then
60- l_lines := ut_utils.clob_to_table(a_exectable.serveroutput);
61- for i in 1 .. l_lines.count loop
62- self.print_text(l_lines(i));
63- end loop;
64- end if;
65- end;
6655 begin
6756 -- l_test_full_name := self.suite_names_stack(self.suite_names_stack.last) || ':' ||
6857 -- nvl(replace(a_test.description, '.'), a_test.name);
6958 l_test_full_name := lower(a_test.item.owner_name) || '.' || lower(a_test.item.object_name) || '.' ||
7059 lower(a_test.item.procedure_name);
71-
60+
7261 if a_test.result = ut_utils.tr_ignore then
7362 self.print_text(ut_teamcity_reporter_helper.test_ignored(l_test_full_name));
7463 else
75-
76- -- reproduce the output from before/after procedures and the test
77- print_output(a_test.before_each);
78- print_output(a_test.before_test);
79- print_output(a_test.item);
80- print_output(a_test.after_test);
81- print_output(a_test.after_each);
82-
64+
65+ self.print_clob(a_test.get_serveroutputs());
66+
8367 if a_test.result = ut_utils.tr_error then
8468 if a_test.before_each.error_backtrace is not null then
8569 l_std_err_msg := l_std_err_msg || 'Before each exception:' || chr(10) || a_test.before_each.error_backtrace || chr(10);
8670 end if;
87-
71+
8872 if a_test.before_test.error_backtrace is not null then
8973 l_std_err_msg := l_std_err_msg || 'Before test exception:' || chr(10) || a_test.before_test.error_backtrace || chr(10);
9074 end if;
91-
75+
9276 if a_test.item.error_backtrace is not null then
9377 l_std_err_msg := l_std_err_msg || 'Test exception:' || chr(10) || a_test.item.error_backtrace || chr(10);
9478 end if;
95-
79+
9680 if a_test.after_test.error_backtrace is not null then
9781 l_std_err_msg := l_std_err_msg || 'After test exception:' || chr(10) || a_test.after_test.error_backtrace || chr(10);
9882 end if;
99-
83+
10084 if a_test.after_each.error_backtrace is not null then
10185 l_std_err_msg := l_std_err_msg || 'After each exception:' || chr(10) || a_test.after_each.error_backtrace || chr(10);
10286 end if;
103-
87+
10488 self.print_text(ut_teamcity_reporter_helper.test_std_err(a_test_name => l_test_full_name
10589 ,a_out => trim(l_std_err_msg)));
10690 self.print_text(ut_teamcity_reporter_helper.test_failed(a_test_name => l_test_full_name
@@ -109,9 +93,9 @@ create or replace type body ut_teamcity_reporter is
10993 .message));
11094 elsif a_test.results is not null and a_test.results.count > 0 then
11195 for i in 1 .. a_test.results.count loop
112-
96+
11397 l_assert := a_test.results(i);
114-
98+
11599 if l_assert.result > ut_utils.tr_success then
116100 self.print_text(ut_teamcity_reporter_helper.test_failed(a_test_name => l_test_full_name
117101 ,a_msg => l_assert.message
@@ -128,17 +112,17 @@ create or replace type body ut_teamcity_reporter is
128112 -- Teamcity supports only a single failure message
129113 exit;
130114 end if;
131-
115+
132116 end loop;
133117 elsif a_test.result = ut_utils.tr_failure then
134118 self.print_text(ut_teamcity_reporter_helper.test_failed(a_test_name => l_test_full_name
135119 ,a_msg => 'Test failed'));
136120 end if;
137-
121+
138122 self.print_text(ut_teamcity_reporter_helper.test_finished(l_test_full_name, trunc(a_test.execution_time * 1e3)));
139-
123+
140124 end if;
141-
125+
142126 end;
143127
144128end;
0 commit comments