Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
54 commits
Select commit Hold shift + click to select a range
287590b
12.2 Stable :
lwasylow Mar 11, 2018
68768f8
12.2 Stable :
lwasylow Mar 13, 2018
76bf869
12.2 Stable :
lwasylow Mar 13, 2018
1f4f5f0
Tests 12.2 Coverage:
lwasylow Mar 14, 2018
90858eb
Added 12.2 coverage
lwasylow Mar 14, 2018
d77cf9a
Test 12.2 coverage
lwasylow Mar 14, 2018
4f83357
Added 12.2 Coverage
lwasylow Mar 14, 2018
ac40332
Added 12.2 Coverage
lwasylow Mar 14, 2018
5f74db9
Merge pull request #602 from lwasylow/12coveragestab2
lwasylow Mar 14, 2018
9d7f16c
Added conditional install of tests for 12.2 only - when block coverag…
jgebal Mar 15, 2018
20541b5
Refactoring coverage:
lwasylow Mar 18, 2018
ab7eb93
Coverage Refactoring:
lwasylow Mar 23, 2018
8dbb1a1
Merge pull request #614 from lwasylow/feature/12cblockcoverage
lwasylow Mar 25, 2018
e0b220d
Merge branch 'develop' into feature/12cblockcoverage
lwasylow Mar 25, 2018
2560f5b
Revert "Feature/12cblockcoverage"
lwasylow Mar 25, 2018
6fe32c5
Merge pull request #615 from utPLSQL/revert-614-feature/12cblockcoverage
lwasylow Mar 25, 2018
8235848
Refactor Coverage:
lwasylow Mar 25, 2018
78fdab5
Refactor Coverage:
lwasylow Mar 25, 2018
3a19341
Merge branch 'feature/12cblockcoverage' of github.com:lwasylow/utPLSQ…
lwasylow Mar 25, 2018
466e126
Update test local
lwasylow Mar 25, 2018
e968f76
Merge pull request #616 from lwasylow/feature/12cblockcoverage
lwasylow Mar 25, 2018
0f1d789
12.2 coverage
lwasylow Apr 3, 2018
faab0fe
Merge pull request #625 from lwasylow/feature/12cblockcoverage
lwasylow Apr 3, 2018
35e5e13
12.2 coverage
lwasylow Apr 3, 2018
1289e99
Merge branch 'feature/12cblockcoverage' of github.com:lwasylow/utPLSQ…
lwasylow Apr 3, 2018
d3ce10c
Merge pull request #626 from lwasylow/feature/12cblockcoverage
lwasylow Apr 3, 2018
c0ca9d3
Fixing error in package name
lwasylow Apr 3, 2018
f151a6e
Update test
lwasylow Apr 4, 2018
28f7653
Statement Coverage First Commit
lwasylow Apr 7, 2018
1f51049
Merge branch 'develop' of https://github.com/utPLSQL/utPLSQL into fea…
lwasylow Apr 7, 2018
9c87b06
Merge branch 'develop' of github.com:utPLSQL/utPLSQL into feature/12c…
lwasylow Apr 7, 2018
d8b8e87
Updated coverage with statement level information
lwasylow Apr 7, 2018
49b1b84
Move get_cov_sql function into common package to remove code duplication
lwasylow Apr 8, 2018
ab7eb24
Refactor Coverage to now enrich profile for partially covered lines u…
lwasylow Apr 8, 2018
36279fa
Update tests and fixed typo in original coverage reporter
lwasylow Apr 10, 2018
661ef74
Merge branch 'feature/12cblockcoverage' of https://github.com/utPLSQL…
lwasylow Apr 10, 2018
57f7a4f
Updated coverage
lwasylow Apr 11, 2018
3a2ff00
Merge branch 'develop' of https://github.com/utPLSQL/utPLSQL into fea…
lwasylow Apr 11, 2018
e6c2be2
Merge pull request #640 from lwasylow/feature/12cov_extended
lwasylow Apr 11, 2018
c9cb004
Fixes to conditional compilation
lwasylow Apr 11, 2018
a862b95
Fixes to new asso array during mock coverage id.
lwasylow Apr 11, 2018
57ee184
Merge pull request #641 from lwasylow/feature/12cblockcoverage
lwasylow Apr 11, 2018
4561795
Update test
lwasylow Apr 11, 2018
0556fbe
Update test
lwasylow Apr 11, 2018
b91e51d
Merge branch 'feature/12cblockcoverage' of github.com:utPLSQL/utPLSQL…
lwasylow Apr 11, 2018
d19f941
Update test/core/reporters/test_extended_coverage.pkb
lwasylow Apr 11, 2018
e2e1437
Updated html reporter to show a information about the partially cover…
lwasylow Apr 11, 2018
a112e36
Added support for block coverage in sonar and cobertura reporters.
jgebal Apr 14, 2018
f0e2653
Clean-up and removal of unnecessary reporters
lwasylow Apr 15, 2018
4458dff
Unify reporters
lwasylow Apr 15, 2018
2027421
Update test
lwasylow Apr 15, 2018
924eb9b
Update issue with part covered being zero.
lwasylow Apr 15, 2018
a111c6d
Update for test with timestamp
lwasylow Apr 15, 2018
2d6c7d3
Merge branch 'develop' into feature/12cblockcoverage
lwasylow Apr 16, 2018
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Refactor Coverage:
Split block and profiler
Added conditional blocks for version less than 12.2
Split html reporter
  • Loading branch information
lwasylow committed Mar 25, 2018
commit 82358489d65055758229e31feecff9fc78cc69ad
89 changes: 89 additions & 0 deletions source/core/coverage/ut_block_helper.pkb
Original file line number Diff line number Diff line change
@@ -0,0 +1,89 @@
create or replace package body ut_block_helper is
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

maybe name it ut_block_coverage_helper - easier to understand

/*
utPLSQL - Version 3
Copyright 2016 - 2017 utPLSQL Project

Licensed under the Apache License, Version 2.0 (the "License"):
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/

type t_proftab_row is record (
line binary_integer,
calls number(38,0)
);

type t_proftab_rows is table of t_proftab_row;

type t_block_row is record(
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would transform the not-so-good Oracle results into:

  • start_line binary_integer
  • end_line binary_integer - (lead(line,1) over(order by line) from coverage data - null if no next line)
  • blocks binary_integer
  • covered_blocks binary_integer

I assume that there is no situation where we have more than 1 block spanning across more than one line.
That is:
only when start_line = end_line we can get blocks>1

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I’m afraid it might be possible for complex multi line if Statement

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Even when simple if and bad beutifier we would have one block in single line.

Copy link
Copy Markdown
Member Author

@lwasylow lwasylow Apr 7, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That will skew the results. Block is not necessary span across mutliple lines, using start and end line will result in showing execution on multiple lines that are not part of block.
Unfortunately block coverage is not including things like LOOP etc. That will give a wrong impression of loop not being executed etc.

line binary_integer
,blocks binary_integer
,covered_blocks binary_integer);

type t_block_rows is table of t_block_row;

procedure coverage_start(a_run_comment varchar2,a_coverage_id out integer) is
begin
a_coverage_id := dbms_plsql_code_coverage.start_coverage(run_comment => a_run_comment);
end;

procedure coverage_stop is
begin
dbms_plsql_code_coverage.stop_coverage();
end;

function block_results(a_object_owner varchar2, a_object_name varchar2) return t_block_rows is
c_raw_coverage sys_refcursor;
l_coverage_rows t_block_rows;
l_coverage_id integer := ut_coverage_helper.get_coverage_id;
begin
open c_raw_coverage for q'[select ccb.line
,count(ccb.block) totalblocks
,sum(ccb.covered)
from dbmspcc_units ccu
left outer join dbmspcc_blocks ccb
on ccu.run_id = ccb.run_id
and ccu.object_id = ccb.object_id
where ccu.run_id = :a_coverage_id
and ccu.owner = :a_object_owner
and ccu.name = :a_object_name
group by ccb.line
order by 1]' using l_coverage_id,a_object_owner,a_object_name;

fetch c_raw_coverage bulk collect into l_coverage_rows;
close c_raw_coverage;

return l_coverage_rows;
end;

function get_raw_coverage_data_block(a_object_owner varchar2, a_object_name varchar2) return ut_coverage_helper.t_unit_line_calls is
l_tmp_data t_block_rows;
l_results ut_coverage_helper.t_unit_line_calls;

begin
l_tmp_data := block_results(a_object_owner => a_object_owner, a_object_name => a_object_name);
for i in 1 .. l_tmp_data.count loop
l_results(l_tmp_data(i).line).blocks := l_tmp_data(i).blocks;
l_results(l_tmp_data(i).line).covered_blocks := l_tmp_data(i).covered_blocks;
l_results(l_tmp_data(i).line).partcovered := case
when (l_tmp_data(i).covered_blocks > 0) and
(l_tmp_data(i).blocks > l_tmp_data(i).covered_blocks) then
1
else
0
end;
end loop;
return l_results;
end;


end;
/
26 changes: 26 additions & 0 deletions source/core/coverage/ut_block_helper.pks
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
create or replace package ut_block_helper authid definer is
/*
utPLSQL - Version 3
Copyright 2016 - 2017 utPLSQL Project

Licensed under the Apache License, Version 2.0 (the "License"):
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/

procedure coverage_start(a_run_comment in varchar2,a_coverage_id out integer);

procedure coverage_stop;

function get_raw_coverage_data_block(a_object_owner varchar2, a_object_name varchar2) return ut_coverage_helper.t_unit_line_calls;

end;
/
Loading