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

Skip to content

Commit 39b68ba

Browse files
committed
TeamCity reporter is now reporting using suitepath to identify logical suites
1 parent b441c54 commit 39b68ba

8 files changed

Lines changed: 35 additions & 68 deletions

source/reporters/ut_teamcity_reporter.tpb

Lines changed: 16 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -24,16 +24,20 @@ create or replace type body ut_teamcity_reporter is
2424

2525
overriding member procedure before_calling_suite(self in out nocopy ut_teamcity_reporter, a_suite in ut_logical_suite) is
2626
begin
27-
self.print_text(ut_teamcity_reporter_helper.test_suite_started(a_suite_name => nvl(replace(trim(a_suite.description)
28-
,'.')
29-
,a_suite.name)));
27+
self.print_text(
28+
ut_teamcity_reporter_helper.test_suite_started(
29+
a_suite_name => nvl(replace(trim(a_suite.description),'.'),a_suite.path)
30+
)
31+
);
3032
end;
3133

3234
overriding member procedure after_calling_suite(self in out nocopy ut_teamcity_reporter, a_suite in ut_logical_suite) is
3335
begin
34-
self.print_text(ut_teamcity_reporter_helper.test_suite_finished(a_suite_name => nvl(replace(trim(a_suite.description)
35-
,'.')
36-
,a_suite.name)));
36+
self.print_text(
37+
ut_teamcity_reporter_helper.test_suite_finished(
38+
a_suite_name => nvl(replace(trim(a_suite.description),'.'),a_suite.path)
39+
)
40+
);
3741
end;
3842

3943
overriding member procedure before_calling_test(self in out nocopy ut_teamcity_reporter, a_test in ut_test) is
@@ -43,8 +47,12 @@ create or replace type body ut_teamcity_reporter is
4347
l_test_full_name := lower(a_test.item.owner_name) || '.' || lower(a_test.item.object_name) || '.' ||
4448
lower(a_test.item.procedure_name);
4549

46-
self.print_text(ut_teamcity_reporter_helper.test_started(a_test_name => l_test_full_name
47-
,a_capture_standard_output => true));
50+
self.print_text(
51+
ut_teamcity_reporter_helper.test_started(
52+
a_test_name => l_test_full_name,
53+
a_capture_standard_output => true
54+
)
55+
);
4856

4957
end;
5058

@@ -53,8 +61,6 @@ create or replace type body ut_teamcity_reporter is
5361
l_test_full_name varchar2(4000);
5462
l_std_err_msg varchar2(32767);
5563
begin
56-
-- l_test_full_name := self.suite_names_stack(self.suite_names_stack.last) || ':' ||
57-
-- nvl(replace(a_test.description, '.'), a_test.name);
5864
l_test_full_name := lower(a_test.item.owner_name) || '.' || lower(a_test.item.object_name) || '.' ||
5965
lower(a_test.item.procedure_name);
6066

source/reporters/ut_teamcity_reporter_helper.pkb

Lines changed: 1 addition & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -45,22 +45,6 @@ create or replace package body ut_teamcity_reporter_helper is
4545

4646
end message;
4747

48-
-- function block_opened(a_name varchar2, a_flow_id varchar2 default null) return varchar2 is
49-
-- l_props t_props;
50-
-- begin
51-
-- l_props('name') := a_name;
52-
-- l_props('flowId') := a_flow_id;
53-
-- return message('blockOpened', l_props);
54-
-- end;
55-
--
56-
-- function block_closed(a_name varchar2, a_flow_id varchar2 default null) return varchar2 is
57-
-- l_props t_props;
58-
-- begin
59-
-- l_props('name') := a_name;
60-
-- l_props('flowId') := a_flow_id;
61-
-- return message('blockClosed', l_props);
62-
-- end;
63-
--
6448
function test_suite_started(a_suite_name varchar2, a_flow_id varchar2 default null) return varchar2 is
6549
l_props t_props;
6650
begin
@@ -123,14 +107,7 @@ create or replace package body ut_teamcity_reporter_helper is
123107

124108
return message('testFailed', l_props);
125109
end;
126-
-- function test_std_out(a_test_name varchar2, a_out in varchar2, a_flow_id in varchar2 default null) return varchar2 is
127-
-- l_props t_props;
128-
-- begin
129-
-- l_props('name') := a_test_name;
130-
-- l_props('out') := a_out;
131-
-- l_props('flowId') := a_flow_id;
132-
-- return message('testStdOut', l_props);
133-
-- end;
110+
134111
function test_std_err(a_test_name varchar2, a_out in varchar2, a_flow_id in varchar2 default null) return varchar2 is
135112
l_props t_props;
136113
begin
@@ -140,15 +117,5 @@ create or replace package body ut_teamcity_reporter_helper is
140117
return message('testStdErr', l_props);
141118
end;
142119

143-
-- function custom_message(a_text in varchar2, a_status in varchar2, a_error_deatils in varchar2 default null, a_flow_id in varchar2 default null) return varchar2 is
144-
-- l_props t_props;
145-
-- begin
146-
-- l_props('text') := a_text;
147-
-- l_props('status') := a_status;
148-
-- l_props('errorDetails') := a_error_deatils;
149-
-- l_props('flowId') := a_flow_id;
150-
-- return message('message', l_props);
151-
-- end;
152-
153120
end ut_teamcity_reporter_helper;
154121
/

source/reporters/ut_teamcity_reporter_helper.pks

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -16,20 +16,14 @@ create or replace package ut_teamcity_reporter_helper is
1616
limitations under the License.
1717
*/
1818

19-
-- function block_opened(a_name varchar2, a_flow_id varchar2 default null) return varchar2;
20-
-- function block_closed(a_name varchar2, a_flow_id varchar2 default null) return varchar2;
21-
2219
function test_suite_started(a_suite_name varchar2, a_flow_id varchar2 default null) return varchar2;
2320
function test_suite_finished(a_suite_name varchar2, a_flow_id varchar2 default null) return varchar2;
2421

2522
function test_started(a_test_name varchar2, a_capture_standard_output boolean default null, a_flow_id varchar2 default null) return varchar2;
2623
function test_finished(a_test_name varchar2, a_test_duration_milisec number default null, a_flow_id varchar2 default null) return varchar2;
2724
function test_disabled(a_test_name varchar2, a_flow_id varchar2 default null) return varchar2;
2825
function test_failed(a_test_name varchar2, a_msg in varchar2 default null, a_details varchar2 default null, a_flow_id varchar2 default null, a_actual varchar2 default null, a_expected varchar2 default null) return varchar2;
29-
-- function test_std_out(a_test_name varchar2, a_out in varchar2, a_flow_id in varchar2 default null) return varchar2;
3026
function test_std_err(a_test_name varchar2, a_out in varchar2, a_flow_id in varchar2 default null) return varchar2;
3127

32-
-- function custom_message(a_text in varchar2, a_status in varchar2, a_error_deatils in varchar2 default null, a_flow_id in varchar2 default null) return varchar2;
33-
3428
end ut_teamcity_reporter_helper;
3529
/

tests/ut/ut.run.AcceptsSutePaths.sql

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,9 @@ begin
88
dbms_output.get_lines( l_output_data, l_num_lines);
99

1010
for i in 1 .. l_num_lines loop
11-
if l_output_data(i) like '%Finished %''test\_package\_1''%' escape '\'
12-
or l_output_data(i) like '%Finished %''test_package_2''%'
13-
or l_output_data(i) like '%Finished %''test_package_3''%' then
11+
if l_output_data(i) like '%Finished %''%test\_package\_1''%' escape '\'
12+
or l_output_data(i) like '%Finished %''%test_package_2''%'
13+
or l_output_data(i) like '%Finished %''%test_package_3''%' then
1414
l_packages_executed := l_packages_executed + 1;
1515
end if;
1616
end loop;

tests/ut/ut.run.WithGivenReporter.ExectutesAllInCurrentSchemaUsingReporter.sql

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,9 @@ begin
88
dbms_output.get_lines( l_output_data, l_num_lines);
99

1010
for i in 1 .. l_num_lines loop
11-
if l_output_data(i) like '%Finished %''test\_package\_1''%' escape '\'
12-
or l_output_data(i) like '%Finished %''test_package_2''%'
13-
or l_output_data(i) like '%Finished %''test_package_3''%' then
11+
if l_output_data(i) like '%Finished %''%test\_package\_1''%' escape '\'
12+
or l_output_data(i) like '%Finished %''%test_package_2''%'
13+
or l_output_data(i) like '%Finished %''%test_package_3''%' then
1414
l_packages_executed := l_packages_executed + 1;
1515
end if;
1616
end loop;

tests/ut/ut.run.function.AcceptsSutePaths.sql

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,9 @@ begin
77
from table(ut.run(ut_varchar2_list('test_package_1','test_package_3'),ut_teamcity_reporter()));
88

99
for i in 1 .. l_output_data.count loop
10-
if l_output_data(i) like '%Finished %''test\_package\_1''%' escape '\'
11-
or l_output_data(i) like '%Finished %''test_package_2''%'
12-
or l_output_data(i) like '%Finished %''test_package_3''%' then
10+
if l_output_data(i) like '%Finished %''%test\_package\_1''%' escape '\'
11+
or l_output_data(i) like '%Finished %''%test_package_2''%'
12+
or l_output_data(i) like '%Finished %''%test_package_3''%' then
1313
l_packages_executed := l_packages_executed + 1;
1414
end if;
1515
end loop;

tests/ut/ut.run.function.WithGivenReporter.ExectutesAllInCurrentSchemaUsingReporter.sql

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,9 @@ begin
77
from table(ut.run(ut_teamcity_reporter()));
88

99
for i in 1 .. l_output_data.count loop
10-
if l_output_data(i) like '%Finished %''test\_package\_1''%' escape '\'
11-
or l_output_data(i) like '%Finished %''test_package_2''%'
12-
or l_output_data(i) like '%Finished %''test_package_3''%' then
10+
if l_output_data(i) like '%Finished %''%test\_package\_1''%' escape '\'
11+
or l_output_data(i) like '%Finished %''%test_package_2''%'
12+
or l_output_data(i) like '%Finished %''%test_package_3''%' then
1313
l_packages_executed := l_packages_executed + 1;
1414
end if;
1515
end loop;

tests/ut_reporters/ut_teamcity_reporter.ProducesExpectedOutputs.sql

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,9 @@ declare
44
l_expected varchar2(32767);
55
begin
66
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']
7+
%##teamcity[testSuiteStarted timestamp='%' name='org.utplsql']
8+
%##teamcity[testSuiteStarted timestamp='%' name='org.utplsql.utplsql']
9+
%##teamcity[testSuiteStarted timestamp='%' name='org.utplsql.utplsql.test']
1010
%##teamcity[testSuiteStarted timestamp='%' name='A suite for testing different outcomes from reporters']
1111
%##teamcity[testStarted timestamp='%' captureStandardOutput='true' name='ut3.test_reporters.passing_test']
1212
<!beforeeach!>
@@ -31,9 +31,9 @@ begin
3131
%##teamcity[testStarted timestamp='%' captureStandardOutput='true' name='ut3.test_reporters.disabled_test']
3232
%##teamcity[testIgnored timestamp='%' name='ut3.test_reporters.disabled_test']
3333
%##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']
34+
%##teamcity[testSuiteFinished timestamp='%' name='org.utplsql.utplsql.test']
35+
%##teamcity[testSuiteFinished timestamp='%' name='org.utplsql.utplsql']
36+
%##teamcity[testSuiteFinished timestamp='%' name='org.utplsql']
3737
%##teamcity[testSuiteFinished timestamp='%' name='org']}';
3838
--act
3939
select *

0 commit comments

Comments
 (0)