Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
36 commits
Select commit Hold shift + click to select a range
133ecae
Adding new API user.
lwasylow Mar 22, 2019
9db8f4b
Separating tests.
lwasylow Mar 23, 2019
13f772a
Merge branch 'develop' of github.com:utPLSQL/utPLSQL into feature/int…
lwasylow Mar 24, 2019
c56943e
Update properties
lwasylow Mar 24, 2019
5afba10
Change user that executes tests as helper that is super user.
lwasylow Mar 24, 2019
7cd92e7
Adding next set of tests migrated.
lwasylow Mar 24, 2019
e2561bc
Adding next set of tests migrated.
lwasylow Mar 25, 2019
887e46a
Fixing test package
lwasylow Mar 25, 2019
28dbd1e
Added set of tests:
lwasylow Mar 25, 2019
d7eb125
Adding set of tests :
lwasylow Mar 25, 2019
99e1099
Adding schema prefix to failing tests from 12.1
lwasylow Mar 25, 2019
04cd36c
Fixing development scripts
lwasylow Mar 25, 2019
3e98723
Fixed bug for deployments with uninstall included.
jgebal Mar 25, 2019
ba83f8f
Merge branch 'feature/introduce_testing_with_accurate_grants' of gith…
lwasylow Mar 26, 2019
0bf1d9e
FIX : removal of non existing types from uninstall script
lwasylow Mar 26, 2019
e914d96
INSTALL:Is it too many monkeys ?:)
lwasylow Mar 26, 2019
174dcbc
Adding set of tests:
lwasylow Mar 26, 2019
0c05daf
Adding set of tests:
lwasylow Mar 26, 2019
80783c3
Adding set of tests:
lwasylow Mar 28, 2019
c4b08af
Adding set of tests:
lwasylow Mar 28, 2019
0618616
Adding set of tests:
lwasylow Mar 28, 2019
29295b7
Adding set of tests:
lwasylow Mar 29, 2019
30b0cfe
Adding set of tests:
lwasylow Mar 29, 2019
3cc34ea
Adding tests
lwasylow Mar 29, 2019
a6a848d
Adding tests:
lwasylow Mar 30, 2019
858372c
Adding set of tests:
lwasylow Mar 31, 2019
620fd61
Adding extra tests:
lwasylow Mar 31, 2019
e6b0673
Merge branch 'develop' of github.com:utPLSQL/utPLSQL into feature/int…
lwasylow Mar 31, 2019
c508e79
Adding tests:
lwasylow Apr 1, 2019
858a675
Fixing broken test.
lwasylow Apr 1, 2019
1642f47
Adding test:
lwasylow Apr 1, 2019
30d27fe
Adding global setup
lwasylow Apr 1, 2019
3b07c6a
Merge branch 'develop' of github.com:utPLSQL/utPLSQL into feature/int…
lwasylow Apr 2, 2019
a8dfa14
Merge branch 'develop' of github.com:utPLSQL/utPLSQL into feature/int…
lwasylow Apr 2, 2019
5d3b18c
Update cleanup script after branching from random order branch
lwasylow Apr 2, 2019
b56d27a
Fixed invalid suitepath in `core` package.
jgebal Apr 3, 2019
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
Adding set of tests:
reporters/test_coverage
reporters/test_debug_reporter
reporters/test_documentation_reporter
reporters/test_extended_coverage
reporters/test_realtime_reporter

Fixing some helper methods.
  • Loading branch information
lwasylow committed Mar 31, 2019
commit 858372c7001e1b2e7106302350d9a35a1cd34993
2 changes: 1 addition & 1 deletion test/grant_ut3_owner_to_ut3_tester.sql
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ begin
and generated = 'N'
and lower(object_name) not like 'sys%')
loop
execute immediate 'grant execute on ut3.'||i.object_name||' to UT3_TESTER';
execute immediate 'grant execute on ut3."'||i.object_name||'" to UT3_TESTER';
end loop;
end;
/
Expand Down
4 changes: 4 additions & 0 deletions test/install_ut3_tester_helper.sql
Original file line number Diff line number Diff line change
Expand Up @@ -11,14 +11,18 @@ alter session set plsql_optimize_level=0;
@@ut3_tester_helper/test_tab_varray.tps
@@ut3_tester_helper/test_dummy_number.tps
@@ut3_tester_helper/ut_test_table.sql
@@ut3_tester_helper/test_event_object.tps
@@ut3_tester_helper/test_event_list.tps

@@ut3_tester_helper/main_helper.pks
@@ut3_tester_helper/run_helper.pks
@@ut3_tester_helper/coverage_helper.pks
@@ut3_tester_helper/expectations_helper.pks
@@ut3_tester_helper/ut_example_tests.pks

@@ut3_tester_helper/main_helper.pkb
@@ut3_tester_helper/run_helper.pkb
@@ut3_tester_helper/coverage_helper.pkb
@@ut3_tester_helper/expectations_helper.pkb
@@ut3_tester_helper/ut_example_tests.pkb

Expand Down
24 changes: 23 additions & 1 deletion test/install_ut3_user_tests.sql
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,18 @@ prompt Install user tests
@@ut3_user/reporters/test_teamcity_reporter.pks
@@ut3_user/reporters/test_sonar_test_reporter.pks
@@ut3_user/reporters/test_junit_reporter.pks
@@ut3_user/reporters/test_documentation_reporter.pks
@@ut3_user/reporters/test_debug_reporter.pks
@@ut3_user/reporters/test_realtime_reporter.pks
@@ut3_user/reporters/test_coverage.pks
set define on
@@install_above_12_1.sql 'ut3_user/reporters/test_extended_coverage.pks'
set define off


--set define on
--@@install_below_12_2.sql 'ut3_user/reporters/test_proftag_coverage.pks'
--@@install_below_12_2.sql 'ut3_user/reporters/test_coverage/test_html_proftab_reporter.pks'
--set define off

@@ut3_user/expectations/unary/test_expect_not_to_be_null.pkb
@@ut3_user/expectations/unary/test_expect_to_be_null.pkb
Expand All @@ -48,6 +58,18 @@ prompt Install user tests
@@ut3_user/reporters/test_teamcity_reporter.pkb
@@ut3_user/reporters/test_sonar_test_reporter.pkb
@@ut3_user/reporters/test_junit_reporter.pkb
@@ut3_user/reporters/test_documentation_reporter.pkb
@@ut3_user/reporters/test_debug_reporter.pkb
@@ut3_user/reporters/test_realtime_reporter.pkb
@@ut3_user/reporters/test_coverage.pkb
set define on
@@install_above_12_1.sql 'ut3_user/reporters/test_extended_coverage.pkb'
set define off

--set define on
--@@install_below_12_2.sql 'ut3_user/reporters/test_coverage.pkb'
--@@install_below_12_2.sql 'ut3_user/reporters/test_coverage/test_html_proftab_reporter.pkb'
--set define off


set linesize 200
Expand Down
215 changes: 215 additions & 0 deletions test/ut3_tester_helper/coverage_helper.pkb
Original file line number Diff line number Diff line change
@@ -0,0 +1,215 @@
create or replace package body coverage_helper is

function get_mock_run_id return integer is
v_result integer;
begin
select nvl(min(runid),0) - 1 into v_result
from ut3.plsql_profiler_runs;
return v_result;
end;

function get_mock_block_run_id return integer is
v_result integer;
begin
select nvl(min(run_id),0) - 1 into v_result
from dbmspcc_runs;
return v_result;
end;

procedure mock_coverage_data(a_run_id integer,a_user in varchar2) is
c_unit_id constant integer := 1;
begin
insert into ut3.plsql_profiler_runs ( runid, run_owner, run_date, run_comment)
values(a_run_id, a_user, sysdate, 'unit testing utPLSQL');

insert into ut3.plsql_profiler_units ( runid, unit_number, unit_type, unit_owner, unit_name)
values(a_run_id, c_unit_id, 'PACKAGE BODY', 'UT3', 'DUMMY_COVERAGE');

insert into ut3.plsql_profiler_data ( runid, unit_number, line#, total_occur, total_time)
select a_run_id, c_unit_id, 4, 1, 1 from dual union all
select a_run_id, c_unit_id, 5, 0, 0 from dual union all
select a_run_id, c_unit_id, 7, 1, 1 from dual;
end;

procedure cleanup_dummy_coverage(a_run_id in integer) is
pragma autonomous_transaction;
begin
delete from ut3.plsql_profiler_data where runid = a_run_id;
delete from ut3.plsql_profiler_units where runid = a_run_id;
delete from ut3.plsql_profiler_runs where runid = a_run_id;
commit;
end;

procedure create_dummy_coverage_package is
pragma autonomous_transaction;
begin
execute immediate q'[create or replace package UT3.DUMMY_COVERAGE is
procedure do_stuff;

procedure grant_myself;
end;]';
execute immediate q'[create or replace package body UT3.DUMMY_COVERAGE is
procedure do_stuff is
begin
if 1 = 2 then
dbms_output.put_line('should not get here');
else
dbms_output.put_line('should get here');
end if;
end;

procedure grant_myself is
begin
execute immediate 'grant debug,execute on UT3.DUMMY_COVERAGE to ut3$user#';
end;
end;]';

end;

procedure create_dummy_coverage_test is
pragma autonomous_transaction;
begin
execute immediate q'[create or replace package UT3.TEST_DUMMY_COVERAGE is
--%suite(dummy coverage test)
--%suitepath(coverage_testing)

--%test
procedure test_do_stuff;

procedure grant_myself;
end;]';
execute immediate q'[create or replace package body UT3.TEST_DUMMY_COVERAGE is
procedure test_do_stuff is
begin
dummy_coverage.do_stuff;
end;

procedure grant_myself is
begin
execute immediate 'grant debug,execute on UT3.TEST_DUMMY_COVERAGE to ut3$user#';
end;
end;]';

end;

procedure grant_exec_on_cov is
pragma autonomous_transaction;
begin
execute immediate 'begin UT3.DUMMY_COVERAGE.grant_myself(); end;';
execute immediate 'begin UT3.TEST_DUMMY_COVERAGE.grant_myself(); end;';
end;

procedure drop_dummy_coverage_pkg is
pragma autonomous_transaction;
begin
begin execute immediate q'[drop package ut3.test_dummy_coverage]'; exception when others then null; end;
begin execute immediate q'[drop package ut3.dummy_coverage]'; exception when others then null; end;
end;


--12.2 Setup
procedure create_dummy_12_2_cov_pck is
pragma autonomous_transaction;
begin
execute immediate q'[create or replace package UT3.DUMMY_COVERAGE_PACKAGE_WITH_AN_AMAZINGLY_LONG_NAME_THAT_YOU_WOULD_NOT_THINK_OF_IN_REAL_LIFE_PROJECT_BECAUSE_ITS_SIMPLY_TOO_LONG is
procedure do_stuff(i_input in number);

procedure grant_myself;
end;]';
execute immediate q'[create or replace package body UT3.DUMMY_COVERAGE_PACKAGE_WITH_AN_AMAZINGLY_LONG_NAME_THAT_YOU_WOULD_NOT_THINK_OF_IN_REAL_LIFE_PROJECT_BECAUSE_ITS_SIMPLY_TOO_LONG is
procedure do_stuff(i_input in number) is
begin
if i_input = 2 then
dbms_output.put_line('should not get here');
else
dbms_output.put_line('should get here');
end if;
end;

procedure grant_myself is
begin
execute immediate 'grant debug,execute on UT3.DUMMY_COVERAGE_PACKAGE_WITH_AN_AMAZINGLY_LONG_NAME_THAT_YOU_WOULD_NOT_THINK_OF_IN_REAL_LIFE_PROJECT_BECAUSE_ITS_SIMPLY_TOO_LONG to ut3$user#';
end;

end;]';
end;

procedure create_dummy_12_2_cov_test is
pragma autonomous_transaction;
begin
execute immediate q'[create or replace package UT3.TEST_BLOCK_DUMMY_COVERAGE is
--%suite(dummy coverage test)
--%suitepath(coverage_testing)

--%test
procedure test_do_stuff;

procedure grant_myself;

end;]';
execute immediate q'[create or replace package body UT3.TEST_BLOCK_DUMMY_COVERAGE is
procedure test_do_stuff is
begin
dummy_coverage_package_with_an_amazingly_long_name_that_you_would_not_think_of_in_real_life_project_because_its_simply_too_long.do_stuff(1);
ut.expect(1).to_equal(1);
end;

procedure grant_myself is
begin
execute immediate 'grant debug,execute on UT3.TEST_BLOCK_DUMMY_COVERAGE to ut3$user#';
end;
end;]';
end;

procedure mock_block_coverage_data(a_run_id integer,a_user in varchar2) is
c_unit_id constant integer := 1;
begin
insert into dbmspcc_runs ( run_id, run_owner, run_timestamp, run_comment)
values(a_run_id, a_user, sysdate, 'unit testing utPLSQL');

insert into dbmspcc_units ( run_id, object_id, type, owner, name,last_ddl_time)
values(a_run_id, c_unit_id, 'PACKAGE BODY', 'UT3', 'DUMMY_COVERAGE_PACKAGE_WITH_AN_AMAZINGLY_LONG_NAME_THAT_YOU_WOULD_NOT_THINK_OF_IN_REAL_LIFE_PROJECT_BECAUSE_ITS_SIMPLY_TOO_LONG',sysdate);

insert into dbmspcc_blocks ( run_id, object_id, line,block,col,covered,not_feasible)
select a_run_id, c_unit_id,4,1,1,1,0 from dual union all
select a_run_id, c_unit_id,4,2,2,0,0 from dual union all
select a_run_id, c_unit_id,5,3,0,1,0 from dual union all
select a_run_id, c_unit_id,7,4,1,1,0 from dual;
end;

procedure mock_profiler_coverage_data(a_run_id integer,a_user in varchar2) is
c_unit_id constant integer := 1;
begin
insert into ut3.plsql_profiler_runs ( runid, run_owner, run_date, run_comment)
values(a_run_id, a_user, sysdate, 'unit testing utPLSQL');

insert into ut3.plsql_profiler_units ( runid, unit_number, unit_type, unit_owner, unit_name)
values(a_run_id, c_unit_id, 'PACKAGE BODY', 'UT3', 'DUMMY_COVERAGE_PACKAGE_WITH_AN_AMAZINGLY_LONG_NAME_THAT_YOU_WOULD_NOT_THINK_OF_IN_REAL_LIFE_PROJECT_BECAUSE_ITS_SIMPLY_TOO_LONG');

insert into ut3.plsql_profiler_data ( runid, unit_number, line#, total_occur, total_time)
select a_run_id, c_unit_id, 4, 1, 1 from dual union all
select a_run_id, c_unit_id, 5, 0, 0 from dual union all
select a_run_id, c_unit_id, 6, 1, 0 from dual union all
select a_run_id, c_unit_id, 7, 1, 1 from dual;
end;

procedure cleanup_dummy_coverage(a_block_id in integer, a_prof_id in integer) is
pragma autonomous_transaction;
begin
begin execute immediate q'[drop package ut3.test_block_dummy_coverage]'; exception when others then null; end;
begin execute immediate q'[drop package ut3.dummy_coverage_package_with_an_amazingly_long_name_that_you_would_not_think_of_in_real_life_project_because_its_simply_too_long]'; exception when others then null; end;
delete from dbmspcc_blocks where run_id = a_block_id;
delete from dbmspcc_units where run_id = a_block_id;
delete from dbmspcc_runs where run_id = a_block_id;
cleanup_dummy_coverage(a_prof_id);
commit;
end;

procedure grant_exec_on_12_2_cov is
pragma autonomous_transaction;
begin
execute immediate 'begin UT3.DUMMY_COVERAGE_PACKAGE_WITH_AN_AMAZINGLY_LONG_NAME_THAT_YOU_WOULD_NOT_THINK_OF_IN_REAL_LIFE_PROJECT_BECAUSE_ITS_SIMPLY_TOO_LONG.grant_myself(); end;';
execute immediate 'begin UT3.TEST_BLOCK_DUMMY_COVERAGE.grant_myself(); end;';
end;
end;
/
27 changes: 27 additions & 0 deletions test/ut3_tester_helper/coverage_helper.pks
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
create or replace package coverage_helper is

g_run_id integer;

type prof_runs_tab is table of ut3.plsql_profiler_runs%rowtype;

function get_mock_run_id return integer;
function get_mock_block_run_id return integer;
procedure cleanup_dummy_coverage(a_run_id in integer);
procedure mock_coverage_data(a_run_id integer,a_user in varchar2);

--Profiler coveage
procedure create_dummy_coverage_package;
procedure create_dummy_coverage_test;
procedure grant_exec_on_cov;
procedure mock_profiler_coverage_data(a_run_id integer,a_user in varchar2);
procedure drop_dummy_coverage_pkg;

--Block coverage
procedure create_dummy_12_2_cov_pck;
procedure create_dummy_12_2_cov_test;
procedure mock_block_coverage_data(a_run_id integer,a_user in varchar2);
procedure cleanup_dummy_coverage(a_block_id in integer, a_prof_id in integer);
procedure grant_exec_on_12_2_cov;

end;
/
20 changes: 20 additions & 0 deletions test/ut3_tester_helper/main_helper.pkb
Original file line number Diff line number Diff line change
Expand Up @@ -134,5 +134,25 @@ create or replace package body main_helper is
where srj.job_name = a_job_name;
end;

procedure append_to_list(a_list in out nocopy ut3.ut_varchar2_list, a_item varchar2) is
begin
ut3.ut_utils.append_to_list(a_list,a_item);
end;

procedure append_to_list(a_list in out nocopy ut3.ut_varchar2_rows, a_item varchar2) is
begin
ut3.ut_utils.append_to_list(a_list,a_item);
end;

procedure append_to_list(a_list in out nocopy ut3.ut_varchar2_rows, a_item clob) is
begin
ut3.ut_utils.append_to_list(a_list,a_item);
end;

procedure append_to_list(a_list in out nocopy ut3.ut_varchar2_rows, a_items ut3.ut_varchar2_rows) is
begin
ut3.ut_utils.append_to_list(a_list,a_items);
end;

end;
/
10 changes: 9 additions & 1 deletion test/ut3_tester_helper/main_helper.pks
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,14 @@ create or replace package main_helper is
procedure parse_dummy_test_as_ut3$user#;

function get_job_count(a_job_name varchar2) return number;


procedure append_to_list(a_list in out nocopy ut3.ut_varchar2_list, a_item varchar2);

procedure append_to_list(a_list in out nocopy ut3.ut_varchar2_rows, a_item varchar2);

procedure append_to_list(a_list in out nocopy ut3.ut_varchar2_rows, a_item clob);

procedure append_to_list(a_list in out nocopy ut3.ut_varchar2_rows, a_items ut3.ut_varchar2_rows);

end;
/
2 changes: 1 addition & 1 deletion test/ut3_tester_helper/run_helper.pkb
Original file line number Diff line number Diff line change
Expand Up @@ -522,6 +522,6 @@ create or replace package body run_helper is
begin
delete from ut3.ut_output_buffer_tmp;
end;

end;
/
5 changes: 4 additions & 1 deletion test/ut3_tester_helper/run_helper.pks
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
create or replace package run_helper is

g_run_id integer;

type t_out_buff_tab is table of ut3.ut_output_buffer_tmp%rowtype;
type prof_runs_tab is table of ut3.plsql_profiler_runs%rowtype;

procedure setup_cache_objects;
procedure setup_cache;
Expand Down Expand Up @@ -49,6 +52,6 @@ create or replace package run_helper is

function ut_output_buffer_tmp return t_out_buff_tab pipelined;
procedure delete_buffer;

end;
/
2 changes: 2 additions & 0 deletions test/ut3_tester_helper/test_event_list.tps
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
create or replace type test_event_list as table of test_event_object;
/
15 changes: 15 additions & 0 deletions test/ut3_tester_helper/test_event_object.tps
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
declare
l_exists integer;
begin
select count(1) into l_exists from user_types where type_name = 'TEST_EVENT_OBJECT';
if l_exists > 0 then
execute immediate 'drop type test_event_object force';
end if;
end;
/

create or replace type test_event_object as object (
event_type varchar2(1000),
event_doc xmltype
)
/
Loading