Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit c179cfc

Browse files
committed
reorganized reporting on exception if in occurred both in before and after
1 parent ce849d2 commit c179cfc

1 file changed

Lines changed: 25 additions & 14 deletions

File tree

source/reporters/ut_teamcity_reporter.tpb

Lines changed: 25 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,7 @@ create or replace type body ut_teamcity_reporter is
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);
54+
l_std_err_msg varchar2(32767);
5455
procedure print_output(a_exectable ut_executable) is
5556
l_lines ut_varchar2_list;
5657
begin
@@ -80,19 +81,32 @@ create or replace type body ut_teamcity_reporter is
8081
print_output(a_test.after_each);
8182

8283
if a_test.result = ut_utils.tr_error then
84+
if a_test.before_each.error_backtrace is not null then
85+
l_std_err_msg := l_std_err_msg || 'Before each:' || chr(10) || a_test.before_each.error_backtrace || chr(10);
86+
end if;
87+
88+
if a_test.before_test.error_backtrace is not null then
89+
l_std_err_msg := l_std_err_msg || 'Before test:' || chr(10) || a_test.before_test.error_backtrace || chr(10);
90+
end if;
91+
92+
if a_test.item.error_backtrace is not null then
93+
l_std_err_msg := l_std_err_msg || 'Test:' || chr(10) || a_test.item.error_backtrace || chr(10);
94+
end if;
95+
96+
if a_test.after_test.error_backtrace is not null then
97+
l_std_err_msg := l_std_err_msg || 'After test:' || chr(10) || a_test.after_test.error_backtrace || chr(10);
98+
end if;
99+
100+
if a_test.after_each.error_backtrace is not null then
101+
l_std_err_msg := l_std_err_msg || 'After each:' || chr(10) || a_test.after_each.error_backtrace || chr(10);
102+
end if;
103+
83104
self.print_text(ut_teamcity_reporter_helper.test_std_err(a_test_name => l_test_full_name
84-
,a_out => coalesce(a_test.before_each.error_backtrace
85-
,a_test.before_test.error_backtrace
86-
,a_test.item.error_backtrace
87-
,a_test.after_test.error_backtrace
88-
,a_test.after_each.error_backtrace)));
105+
,a_out => trim(l_std_err_msg)));
89106
self.print_text(ut_teamcity_reporter_helper.test_failed(a_test_name => l_test_full_name
90-
,a_msg => 'Test failed with an exception'
91-
,a_details => coalesce(a_test.before_each.error_stack
92-
,a_test.before_test.error_stack
93-
,a_test.item.error_stack
94-
,a_test.after_test.error_stack
95-
,a_test.after_each.error_stack)));
107+
,a_msg => 'Error occured'
108+
,a_details => trim(l_std_err_msg) || a_test.results(1)
109+
.message));
96110
elsif a_test.results is not null and a_test.results.count > 0 then
97111
for i in 1 .. a_test.results.count loop
98112

@@ -119,9 +133,6 @@ create or replace type body ut_teamcity_reporter is
119133
elsif a_test.result = ut_utils.tr_failure then
120134
self.print_text(ut_teamcity_reporter_helper.test_failed(a_test_name => l_test_full_name
121135
,a_msg => 'Test failed'));
122-
elsif a_test.result = ut_utils.tr_error then
123-
self.print_text(ut_teamcity_reporter_helper.test_failed(a_test_name => l_test_full_name
124-
,a_msg => 'Error occured'));
125136
end if;
126137

127138
self.print_text(ut_teamcity_reporter_helper.test_finished(l_test_full_name, trunc(a_test.execution_time * 1e3)));

0 commit comments

Comments
 (0)