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

Skip to content

Commit b1f6323

Browse files
Initial, incomplete version of reporter
1 parent f69d65c commit b1f6323

2 files changed

Lines changed: 149 additions & 0 deletions

File tree

Lines changed: 93 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,93 @@
1+
create or replace type body ut_sqldev_reporter is
2+
/*
3+
utPLSQL - Version 3
4+
Copyright 2016 - 2018 utPLSQL Project
5+
6+
Licensed under the Apache License, Version 2.0 (the "License"):
7+
you may not use this file except in compliance with the License.
8+
You may obtain a copy of the License at
9+
10+
http://www.apache.org/licenses/LICENSE-2.0
11+
12+
Unless required by applicable law or agreed to in writing, software
13+
distributed under the License is distributed on an "AS IS" BASIS,
14+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15+
See the License for the specific language governing permissions and
16+
limitations under the License.
17+
*/
18+
19+
constructor function ut_sqldev_reporter(self in out nocopy ut_sqldev_reporter) return self as result is
20+
begin
21+
self.init($$plsql_unit);
22+
return;
23+
end;
24+
25+
overriding member procedure before_calling_run(self in out nocopy ut_sqldev_reporter, a_run in ut_run) is
26+
procedure print_test_elements(a_test ut_test) is
27+
begin
28+
self.print_text('<testcase path="' || a_test.path || '"'
29+
|| ' executable_type="' || a_test.item.executable_type || '"'
30+
|| ' owner_name="' || a_test.item.owner_name || '"'
31+
|| ' object_name="' || a_test.item.object_name || '"'
32+
|| ' procedure_name="' || a_test.item.procedure_name || '"'
33+
|| ' disabled="' || case when a_test.get_disabled_flag() then 'true' else 'false' end || '"'
34+
|| ' name="' || a_test.name || '"'
35+
|| ' description="' || a_test.description || '"/>');
36+
end;
37+
38+
procedure print_suite_elements(a_suite ut_logical_suite) is
39+
begin
40+
self.print_text('<testsuite path="' || a_suite.path || '"'
41+
|| ' name="' || a_suite.name || '"'
42+
|| ' description="' || a_suite.description || '">');
43+
for i in 1 .. a_suite.items.count loop
44+
if a_suite.items(i) is of(ut_test) then
45+
print_test_elements(treat(a_suite.items(i) as ut_test));
46+
elsif a_suite.items(i) is of(ut_logical_suite) then
47+
print_suite_elements(treat(a_suite.items(i) as ut_logical_suite));
48+
end if;
49+
end loop;
50+
self.print_text('</testsuite>');
51+
end;
52+
53+
begin
54+
self.print_text(ut_utils.get_xml_header(a_run.client_character_set));
55+
self.print_text('<report>');
56+
self.print_text('<prolog>');
57+
self.print_text('<testsuites>');
58+
for i in 1 .. a_run.items.count loop
59+
print_suite_elements(treat(a_run.items(i) as ut_logical_suite));
60+
end loop;
61+
self.print_text('</testsuites>');
62+
self.print_text('</prolog>');
63+
self.print_text('<run>');
64+
end;
65+
66+
overriding member procedure before_calling_test(self in out nocopy ut_sqldev_reporter, a_test in ut_test) as
67+
begin
68+
self.print_text('<test path="' || a_test.path || '"'
69+
|| ' executable_type="' || a_test.item.executable_type || '"'
70+
|| ' owner_name="' || a_test.item.owner_name || '"'
71+
|| ' object_name="' || a_test.item.object_name || '"'
72+
|| ' procedure_name="' || a_test.item.procedure_name || '"'
73+
|| ' disabled="' || case when a_test.get_disabled_flag() then 'true' else 'false' end || '"/>');
74+
end;
75+
76+
overriding member procedure after_calling_test(self in out nocopy ut_sqldev_reporter, a_test in ut_test) as
77+
begin
78+
self.print_text('');
79+
end;
80+
81+
overriding member procedure after_calling_run(self in out nocopy ut_sqldev_reporter, a_run in ut_run) as
82+
begin
83+
self.print_text('</run>');
84+
self.print_text('</report>');
85+
end;
86+
87+
overriding member function get_description return varchar2 as
88+
begin
89+
return 'Provides test results in a XML format, to consumed by clients such as SQL Developer interested progressing details.';
90+
end;
91+
92+
end;
93+
/
Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
create or replace type ut_sqldev_reporter force under ut_output_reporter_base(
2+
/*
3+
utPLSQL - Version 3
4+
Copyright 2016 - 2018 utPLSQL Project
5+
6+
Licensed under the Apache License, Version 2.0 (the "License"):
7+
you may not use this file except in compliance with the License.
8+
You may obtain a copy of the License at
9+
10+
http://www.apache.org/licenses/LICENSE-2.0
11+
12+
Unless required by applicable law or agreed to in writing, software
13+
distributed under the License is distributed on an "AS IS" BASIS,
14+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15+
See the License for the specific language governing permissions and
16+
limitations under the License.
17+
*/
18+
19+
-- TODO: grant execute on ut_sqldev_reporter to public;
20+
-- TODO: handle public synonym
21+
-- TODO: unit test
22+
23+
/**
24+
* The SQL Developer reporter.
25+
* Provides test results in a XML format, to consumed by clients such as SQL Developer interested progressing details.
26+
*/
27+
constructor function ut_sqldev_reporter(self in out nocopy ut_sqldev_reporter) return self as result,
28+
29+
/**
30+
* Provides meta data of complete run in advance.
31+
* Used in IDE to show total tests and initialize a progress bar.
32+
*/
33+
overriding member procedure before_calling_run(self in out nocopy ut_sqldev_reporter, a_run in ut_run),
34+
35+
/**
36+
* Provides meta data of test to be called.
37+
*/
38+
overriding member procedure before_calling_test(self in out nocopy ut_sqldev_reporter, a_test in ut_test),
39+
40+
/**
41+
* Provides meta data of a completed test with runtime, status,
42+
*/
43+
overriding member procedure after_calling_test(self in out nocopy ut_sqldev_reporter, a_test in ut_test),
44+
45+
/**
46+
* Provides closing tag with runtime summary.
47+
*/
48+
overriding member procedure after_calling_run(self in out nocopy ut_sqldev_reporter, a_run in ut_run),
49+
50+
/**
51+
* Provides the description of this reporter.
52+
*/
53+
overriding member function get_description return varchar2
54+
)
55+
not final
56+
/

0 commit comments

Comments
 (0)