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

Skip to content

Commit c850b38

Browse files
committed
Resolves issues with teamcity reporter:
- the `[` and `]` were not escaped - the `"` was escaped though not needed - If total length of message inside the square brackets exceeds 4000 characters it's causing teamcity to report success for a test failed Resolves #747
1 parent f590d77 commit c850b38

3 files changed

Lines changed: 6 additions & 6 deletions

File tree

source/reporters/ut_teamcity_reporter_helper.pkb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ create or replace package body ut_teamcity_reporter_helper is
2121

2222
function escape_value(a_value in varchar2) return varchar2 is
2323
begin
24-
return translate(regexp_replace(a_value, '(''|"|[|]|' || chr(13) || '|' || chr(10) || ')', '|\1'),chr(13)||chr(10),'nr');
24+
return translate(regexp_replace(a_value, q'/(\'|\||\[|\]|/' || chr(13) || '|' || chr(10) || ')', '|\1'),chr(13)||chr(10),'rn');
2525
end;
2626

2727
function message(a_command in varchar2, a_props t_props default cast(null as t_props)) return varchar2 is
@@ -35,7 +35,7 @@ create or replace package body ut_teamcity_reporter_helper is
3535
l_index := a_props.first;
3636
while l_index is not null loop
3737
if a_props(l_index) is not null then
38-
l_value := escape_value(a_props(l_index));
38+
l_value := substr(escape_value(a_props(l_index)),1,2000);
3939
l_message := l_message || ' ' || l_index || '=''' || l_value || '''';
4040
end if;
4141
l_index := a_props.next(l_index);

test/core/reporters.pkb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ as
7676
is
7777
begin
7878
dbms_output.put_line('<!failing test!>');
79-
ut3.ut.expect(1,'Fails as values are different').to_equal(2);
79+
ut3.ut.expect('number [1] ','Fails as values are different').to_equal('number [2] ');
8080
end;
8181

8282
procedure erroring_test

test/core/reporters/test_teamcity_reporter.pkb

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,14 +22,14 @@ create or replace package body test_teamcity_reporter as
2222
<!beforeeach!>
2323
<!failing test!>
2424
<!aftereach!>
25-
%##teamcity[testFailed timestamp='%' message='Fails as values are different' name='ut3_tester.test_reporters.failing_test']
25+
%##teamcity[testFailed timestamp='%' details='Actual: |'number |[1|] |' (varchar2) was expected to equal: |'number |[2|] |' (varchar2) ' message='Fails as values are different' name='ut3_tester.test_reporters.failing_test']
2626
%##teamcity[testFinished timestamp='%' duration='%' name='ut3_tester.test_reporters.failing_test']
2727
%##teamcity[testStarted timestamp='%' captureStandardOutput='true' name='ut3_tester.test_reporters.erroring_test']
2828
<!beforeeach!>
2929
<!erroring test!>
3030
<!aftereach!>
31-
%##teamcity[testStdErr timestamp='%' name='ut3_tester.test_reporters.erroring_test' out='Test exception:|rORA-06512: at |"UT3_TESTER.TEST_REPORTERS|", line %|rORA-06512: at %|r|r']
32-
%##teamcity[testFailed timestamp='%' details='Test exception:|rORA-06512: at |"UT3_TESTER.TEST_REPORTERS|", line %|rORA-06512: at %|r|r' message='Error occured' name='ut3_tester.test_reporters.erroring_test']
31+
%##teamcity[testStdErr timestamp='%' name='ut3_tester.test_reporters.erroring_test' out='Test exception:|nORA-06512: at "UT3_TESTER.TEST_REPORTERS", line %|nORA-06512: at %|n|n']
32+
%##teamcity[testFailed timestamp='%' details='Test exception:|nORA-06512: at "UT3_TESTER.TEST_REPORTERS", line %|nORA-06512: at %|n|n' message='Error occured' name='ut3_tester.test_reporters.erroring_test']
3333
%##teamcity[testFinished timestamp='%' duration='%' name='ut3_tester.test_reporters.erroring_test']
3434
%##teamcity[testStarted timestamp='%' captureStandardOutput='true' name='ut3_tester.test_reporters.disabled_test']
3535
%##teamcity[testIgnored timestamp='%' name='ut3_tester.test_reporters.disabled_test']

0 commit comments

Comments
 (0)