Skip to content

Commit 73e9cf3

Browse files
committed
Added missing test for multiple expectation failures with exception thrown.
1 parent 55a2ecf commit 73e9cf3

File tree

3 files changed

+41
-6
lines changed

3 files changed

+41
-6
lines changed

test/ut3_user/reporters.pkb

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -90,11 +90,10 @@ as
9090

9191
procedure erroring_test
9292
is
93-
l_variable integer;
93+
l_integer_variable integer;
9494
begin
9595
dbms_output.put_line('<!erroring test!>');
96-
l_variable := 'a string';
97-
ut3_develop.ut.expect(l_variable).to_equal(1);
96+
l_integer_variable := 'a string';
9897
end;
9998

10099
procedure disabled_test

test/ut3_user/reporters/test_teamcity_reporter.pkb

Lines changed: 35 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,9 @@ create or replace package body test_teamcity_reporter as
3636

3737
--%test
3838
procedure multi_failure;
39+
40+
--%test
41+
procedure multi_failure_on_error;
3942
end;]';
4043
execute immediate q'[create or replace package body check_multiple_failures is
4144
procedure multi_failure is
@@ -44,6 +47,14 @@ create or replace package body test_teamcity_reporter as
4447
ut3_develop.ut.expect(2).to_equal(1);
4548
ut3_develop.ut.expect('Bad').to_equal('Good');
4649
end;
50+
procedure multi_failure_on_error is
51+
l_integer_variable integer;
52+
begin
53+
ut3_develop.ut.expect(1).to_be_null;
54+
ut3_develop.ut.expect(2).to_equal(1);
55+
ut3_develop.ut.expect('Bad').to_equal('Good');
56+
l_integer_variable := 'a string';
57+
end;
4758
end;]';
4859

4960
end;
@@ -132,7 +143,7 @@ create or replace package body test_teamcity_reporter as
132143
ut.expect(ut3_tester_helper.main_helper.table_to_clob(l_output_data)).to_be_like(l_expected);
133144
end;
134145

135-
procedure report_mutiple_expectations is
146+
procedure report_multiple_expectations is
136147
l_output_data ut3_develop.ut_varchar2_list;
137148
l_expected varchar2(32767);
138149
begin
@@ -146,7 +157,29 @@ create or replace package body test_teamcity_reporter as
146157
--act
147158
select *
148159
bulk collect into l_output_data
149-
from table(ut3_develop.ut.run('check_multiple_failures',ut3_develop.ut_teamcity_reporter()));
160+
from table(ut3_develop.ut.run('check_multiple_failures.multi_failure',ut3_develop.ut_teamcity_reporter()));
161+
162+
--assert
163+
ut.expect(ut3_tester_helper.main_helper.table_to_clob(l_output_data)).to_be_like(l_expected);
164+
end;
165+
166+
procedure report_multiple_expect_on_err is
167+
l_output_data ut3_develop.ut_varchar2_list;
168+
l_expected varchar2(32767);
169+
begin
170+
l_expected := q'{%##teamcity[testSuiteStarted timestamp='%' name='check_multiple_failures']
171+
%##teamcity[testStarted timestamp='%' captureStandardOutput='true' name='ut3_user.check_multiple_failures.multi_failure_on_error']
172+
%##teamcity[testStdErr timestamp='%' name='ut3_user.check_multiple_failures.multi_failure_on_error' out='Test exception:|nORA-06502: PL/SQL: %: character to number conversion error|nORA-06512: at "UT3_USER.CHECK_MULTIPLE_FAILURES", line %|nORA-06512: at %|n']
173+
%##teamcity[testFailed timestamp='%' details='Test exception:|nORA-06502: PL/SQL: %: character to number conversion error|nORA-06512: at "UT3_USER.CHECK_MULTIPLE_FAILURES", line %|nORA-06512: at %|n' message='Error occured' name='ut3_user.check_multiple_failures.multi_failure_on_error']
174+
%##teamcity[testFailed timestamp='%' details='Actual: 1 (number) was expected to be null' name='ut3_user.check_multiple_failures.multi_failure_on_error']
175+
%##teamcity[testFailed timestamp='%' details='Actual: 2 (number) was expected to equal: 1 (number)' name='ut3_user.check_multiple_failures.multi_failure_on_error']
176+
%##teamcity[testFailed timestamp='%' details='Actual: |'Bad|' (varchar2) was expected to equal: |'Good|' (varchar2)' name='ut3_user.check_multiple_failures.multi_failure_on_error']
177+
%##teamcity[testFinished timestamp='%' duration='%' name='ut3_user.check_multiple_failures.multi_failure_on_error']
178+
%##teamcity[testSuiteFinished timestamp='%' name='check_multiple_failures']}';
179+
--act
180+
select *
181+
bulk collect into l_output_data
182+
from table(ut3_develop.ut.run('check_multiple_failures.multi_failure_on_error',ut3_develop.ut_teamcity_reporter()));
150183

151184
--assert
152185
ut.expect(ut3_tester_helper.main_helper.table_to_clob(l_output_data)).to_be_like(l_expected);

test/ut3_user/reporters/test_teamcity_reporter.pks

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,10 @@ create or replace package test_teamcity_reporter as
1616
procedure trims_long_output;
1717

1818
--%test(Reports failures on multiple expectations)
19-
procedure report_mutiple_expectations;
19+
procedure report_multiple_expectations;
20+
21+
--%test(Reports failures on multiple expectations)
22+
procedure report_multiple_expect_on_err;
2023

2124
--%afterall
2225
procedure remove_test_package;

0 commit comments

Comments
 (0)