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

Skip to content

Commit da01280

Browse files
committed
Merge remote-tracking branch 'upstream/feature/sonar_test_reporter_fix' into feature/using_released_to_test_develop
2 parents d34c9a6 + f9b8191 commit da01280

4 files changed

Lines changed: 38 additions & 18 deletions

File tree

source/reporters/ut_sonar_test_reporter.tpb

Lines changed: 14 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -33,15 +33,17 @@ create or replace type body ut_sonar_test_reporter is
3333
overriding member procedure before_calling_suite(self in out nocopy ut_sonar_test_reporter, a_suite ut_logical_suite) is
3434
l_file_name varchar2(4000);
3535
begin
36-
for i in 1 .. self.file_mappings.count loop
37-
if upper(self.file_mappings(i).object_name) = upper(a_suite.object_name)
38-
and upper(self.file_mappings(i).object_owner) = upper(a_suite.object_owner) then
39-
l_file_name := self.file_mappings(i).file_name;
40-
exit;
41-
end if;
42-
end loop;
43-
l_file_name := coalesce(l_file_name, a_suite.path);
44-
self.print_text('<file path="'||l_file_name||'">');
36+
if a_suite is of (ut_suite) then
37+
for i in 1 .. self.file_mappings.count loop
38+
if upper(self.file_mappings(i).object_name) = upper(a_suite.object_name)
39+
and upper(self.file_mappings(i).object_owner) = upper(a_suite.object_owner) then
40+
l_file_name := self.file_mappings(i).file_name;
41+
exit;
42+
end if;
43+
end loop;
44+
l_file_name := coalesce(l_file_name, a_suite.path);
45+
self.print_text('<file path="'||l_file_name||'">');
46+
end if;
4547
end;
4648

4749
overriding member procedure after_calling_test(self in out nocopy ut_sonar_test_reporter, a_test ut_test) is
@@ -74,7 +76,9 @@ create or replace type body ut_sonar_test_reporter is
7476

7577
overriding member procedure after_calling_suite(self in out nocopy ut_sonar_test_reporter, a_suite ut_logical_suite) is
7678
begin
77-
self.print_text('</file>');
79+
if a_suite is of (ut_suite) then
80+
self.print_text('</file>');
81+
end if;
7882
end;
7983

8084
overriding member procedure after_calling_run(self in out nocopy ut_sonar_test_reporter, a_run in ut_run) is

tests/helpers/test_reporters.pks

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
create or replace package test_reporters
22
as
33
--%suite(A suite for testing different outcomes from reporters)
4-
4+
--%suitepath(org.utplsql.utplsql.test)
55
--%beforeall
66
procedure beforeall;
77

tests/ut_reporters/ut_teamcity_reporter.ProducesExpectedOutputs.sql

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,11 @@ declare
33
l_output clob;
44
l_expected varchar2(32767);
55
begin
6-
l_expected := q'{##teamcity[testSuiteStarted timestamp='%' name='A suite for testing different outcomes from reporters']
6+
l_expected := q'{%##teamcity[testSuiteStarted timestamp='%' name='org']
7+
%##teamcity[testSuiteStarted timestamp='%' name='utplsql']
8+
%##teamcity[testSuiteStarted timestamp='%' name='utplsql']
9+
%##teamcity[testSuiteStarted timestamp='%' name='test']
10+
%##teamcity[testSuiteStarted timestamp='%' name='A suite for testing different outcomes from reporters']
711
%##teamcity[testStarted timestamp='%' captureStandardOutput='true' name='ut3.test_reporters.passing_test']
812
<!beforeeach!>
913
<!beforetest!>
@@ -26,7 +30,11 @@ begin
2630
%##teamcity[testFinished timestamp='%' duration='%' name='ut3.test_reporters.erroring_test']
2731
%##teamcity[testStarted timestamp='%' captureStandardOutput='true' name='ut3.test_reporters.disabled_test']
2832
%##teamcity[testIgnored timestamp='%' name='ut3.test_reporters.disabled_test']
29-
%##teamcity[testSuiteFinished timestamp='%' name='A suite for testing different outcomes from reporters']}';
33+
%##teamcity[testSuiteFinished timestamp='%' name='A suite for testing different outcomes from reporters']
34+
%##teamcity[testSuiteFinished timestamp='%' name='test']
35+
%##teamcity[testSuiteFinished timestamp='%' name='utplsql']
36+
%##teamcity[testSuiteFinished timestamp='%' name='utplsql']
37+
%##teamcity[testSuiteFinished timestamp='%' name='org']}';
3038
--act
3139
select *
3240
bulk collect into l_output_data

tests/ut_reporters/ut_xunit_reporter.ProducesExpectedOutputs.sql

Lines changed: 13 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,24 +4,32 @@ declare
44
l_expected varchar2(32767);
55
begin
66
l_expected := q'[<testsuites tests="4" skipped="1" error="1" failure="1" name="%" time="%" >
7-
<testsuite tests="4" id="1" package="test_reporters" skipped="1" error="1" failure="1" name="%" time="%" >
7+
<testsuite tests="4" id="1" package="org" skipped="1" error="1" failure="1" name="org" time="%" >
8+
<testsuite tests="4" id="2" package="org.utplsql" skipped="1" error="1" failure="1" name="utplsql" time="%" >
9+
<testsuite tests="4" id="3" package="org.utplsql.utplsql" skipped="1" error="1" failure="1" name="utplsql" time="%" >
10+
<testsuite tests="4" id="4" package="org.utplsql.utplsql.test" skipped="1" error="1" failure="1" name="test" time="%" >
11+
<testsuite tests="4" id="5" package="org.utplsql.utplsql.test.test_reporters" skipped="1" error="1" failure="1" name="%" time="%" >
812
<system-out>%<!beforeall!>%<!afterall!>%</system-out>
9-
<testcase classname="test_reporters" assertions="1" skipped="0" error="0" failure="0" name="%" time="%" >
13+
<testcase classname="org.utplsql.utplsql.test.test_reporters" assertions="1" skipped="0" error="0" failure="0" name="%" time="%" >
1014
<system-out>%<!beforeeach!>%<!beforetest!>%<!passing test!>%<!aftertest!>%<!aftereach!>%</system-out>
1115
</testcase>
12-
<testcase classname="test_reporters" assertions="1" skipped="0" error="0" failure="1" name="%" time="%" status="Failure">
16+
<testcase classname="org.utplsql.utplsql.test.test_reporters" assertions="1" skipped="0" error="0" failure="1" name="%" time="%" status="Failure">
1317
<failure>%"Fails as values are different"
1418
Actual: 1 (number) was expected to equal: 2 (number)%</failure>
1519
<system-out>%</system-out>
1620
</testcase>
17-
<testcase classname="test_reporters" assertions="0" skipped="0" error="1" failure="0" name="%" time="%" status="Error">
21+
<testcase classname="org.utplsql.utplsql.test.test_reporters" assertions="0" skipped="0" error="1" failure="0" name="%" time="%" status="Error">
1822
<error>%ORA-06502:%</error>
1923
<system-out>%</system-out>
2024
</testcase>
21-
<testcase classname="test_reporters" assertions="0" skipped="1" error="0" failure="0" name="%" time="0" status="Disabled">
25+
<testcase classname="org.utplsql.utplsql.test.test_reporters" assertions="0" skipped="1" error="0" failure="0" name="%" time="0" status="Disabled">
2226
<skipped/>
2327
</testcase>
2428
</testsuite>
29+
</testsuite>
30+
</testsuite>
31+
</testsuite>
32+
</testsuite>
2533
</testsuites>]';
2634

2735
--act

0 commit comments

Comments
 (0)