Skip to content

Commit aec15ed

Browse files
committed
Unit Testing Updates
1 parent 16f2b02 commit aec15ed

5 files changed

Lines changed: 77 additions & 64 deletions

File tree

builds/OraEE213_AP212_ORDS222/build.sh

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -128,6 +128,8 @@ function setup_for_test {
128128
echo ""
129129
echo "Running ../util/setup_for_test.sql from ${PWD}"
130130
sqlplus "${PDB_SYSTEM}" "@../util/setup_for_test.sql"
131+
echo "Running ../util/setup_db_links.sql from ${PWD}"
132+
sqlplus "${PDB_WTP}" "@../util/setup_db_links.sql.sql"
131133
}
132134

133135
########################################

builds/util/run_core_test.sql

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -17,10 +17,12 @@ set trimspool on
1717
set echo off
1818

1919
----------------------------------------
20-
prompt
21-
prompt Initialize Hooks.
22-
execute wt_test_run.delete_hooks;
23-
execute junit_core_report.delete_hooks;
20+
-- Should be default Installation Settings
21+
--prompt
22+
--prompt Initialize Hooks.
23+
--execute wt_test_run.delete_hooks;
24+
--execute junit_core_report.delete_hooks;
25+
--execute wt_core_report.insert_hooks;
2426

2527
----------------------------------------
2628
prompt

builds/util/setup_db_links.sql

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
2+
--
3+
-- Setup for Unit Testing
4+
--
5+
-- Run as SYS or SYSTEM
6+
--
7+
8+
set serveroutput on size unlimited format wrapped
9+
10+
----------------------------------------
11+
prompt
12+
prompt Recreate Database Links
13+
declare
14+
procedure run_sql (in_sql in varchar2) is
15+
-- ORA-02024: database link not found
16+
no_db_link exception;
17+
pragma exception_init(no_db_link, -02024);
18+
begin
19+
dbms_output.put_line(in_sql);
20+
execute immediate in_sql;
21+
exception
22+
when no_db_link then
23+
null; -- Ignore this errror;
24+
when others then
25+
dbms_output.put_line(SQLERRM || CHR(10));
26+
end run_sql;
27+
begin
28+
-- Test every Schema Owner in the Database
29+
for buff in (select proc.owner TEST_OWNER
30+
from dba_procedures proc
31+
where proc.procedure_name = 'WTPLSQL_RUN'
32+
and proc.object_type = 'PACKAGE'
33+
group by proc.owner
34+
order by proc.owner )
35+
loop
36+
run_sql('alter session set current_schema = "' || buff.TEST_OWNER || '"');
37+
run_sql('drop database link "' || buff.TEST_OWNER || '"');
38+
run_sql('create database link "' || buff.TEST_OWNER ||
39+
'" connect to "' || buff.TEST_OWNER ||
40+
'" identified by "' || buff.TEST_OWNER ||
41+
'" using ''//localhost:1521/' || SYS_CONTEXT('USERENV','SERVICE_NAME') || '''');
42+
end loop;
43+
run_sql('alter session set current_schema = "' || USER || '"');
44+
end;
45+
/
46+
47+
exit

builds/util/setup_for_test.sql

Lines changed: 0 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -96,39 +96,4 @@ begin
9696
end;
9797
/
9898

99-
----------------------------------------
100-
prompt
101-
prompt Recreate Database Links
102-
declare
103-
procedure run_sql (in_sql in varchar2) is
104-
-- ORA-02024: database link not found
105-
no_db_link exception;
106-
pragma exception_init(no_db_link, -02024);
107-
begin
108-
dbms_output.put_line(in_sql);
109-
execute immediate in_sql;
110-
exception
111-
when no_db_link then
112-
null; -- Ignore this errror;
113-
when others then
114-
dbms_output.put_line(SQLERRM || CHR(10));
115-
end run_sql;
116-
begin
117-
-- Test every Schema Owner in the Database
118-
for buff in (select proc.owner TEST_OWNER
119-
from dba_procedures proc
120-
where proc.procedure_name = 'WTPLSQL_RUN'
121-
and proc.object_type = 'PACKAGE'
122-
group by proc.owner
123-
order by proc.owner )
124-
loop
125-
run_sql('drop database link "WTP"."' || buff.TEST_OWNER || '"');
126-
run_sql('create database link "WTP"."' || buff.TEST_OWNER ||
127-
'" connect to "' || buff.TEST_OWNER ||
128-
'" identified by "' || buff.TEST_OWNER ||
129-
'" using ''//localhost:1521/' || SYS_CONTEXT('USERENV','SERVICE_NAME') || '''');
130-
end loop;
131-
end;
132-
/
133-
13499
exit

wtpsrc/WTP/WT_ASSERT.pbody

Lines changed: 22 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -136,6 +136,14 @@ $THEN
136136
l_line varchar2(32767);
137137
l_status pls_integer;
138138
begin
139+
-------------------------------------- WTPLSQL Testing --
140+
loop
141+
dbms_output.get_line(l_line, l_status);
142+
exit when l_status = 1;
143+
wt_assert.isnull
144+
(msg_in => 'Clear DBMS_OUTPUT Buffer'
145+
,check_this_in => l_line);
146+
end loop;
139147
-------------------------------------- WTPLSQL Testing --
140148
wt_assert.g_testcase := 'Ad Hoc Report Happy Path';
141149
g_rec.last_assert := 'THIS';
@@ -2539,11 +2547,9 @@ $THEN
25392547
msg_in => 'temp_rec.last_details',
25402548
check_this_in => temp_rec.last_details,
25412549
against_this_in => 'Expected exception "%PLS-00302: component ''BOGUS'' must be declared%". ' ||
2542-
'Actual exception raised was "ORA-06550: line 1, column 17:' || CHR(10) ||
2543-
'PLS-00302: component ''BOGUS'' must be declared' || CHR(10) ||
2544-
'ORA-06550: line 1, column 7:' || CHR(10) ||
2545-
'PL/SQL: Statement ignored". ' ||
2546-
'Exception raised by: "begin wt_assert.bogus; end;".');
2550+
'Actual exception raised was "ORA-06550: line 1, column 17:' || CHR(10) ||
2551+
'PLS-00302: component ''BOGUS'' must be declared". ' ||
2552+
'Exception raised by: "begin wt_assert.bogus; end;".' );
25472553
-------------------------------------- WTPLSQL Testing --
25482554
wt_assert.g_testcase := 'Raises Tests Happy Path 2';
25492555
raises (
@@ -2554,13 +2560,10 @@ $THEN
25542560
wt_assert.eq (
25552561
msg_in => 'temp_rec.last_details value',
25562562
check_this_in => temp_rec.last_details,
2557-
against_this_in => 'Expected exception "%-00302%". ' ||
2558-
'Actual exception raised was "' ||
2559-
'ORA-06550: line 1, column 17:' || CHR(10) ||
2560-
'PLS-00302: component ''BOGUS'' must be declared' || CHR(10) ||
2561-
'ORA-06550: line 1, column 7:' || CHR(10) ||
2562-
'PL/SQL: Statement ignored". ' ||
2563-
'Exception raised by: "begin wt_assert.bogus; end;".');
2563+
against_this_in => 'Expected exception "%-00302%". ' ||
2564+
'Actual exception raised was "ORA-06550: line 1, column 17:' || CHR(10) ||
2565+
'PLS-00302: component ''BOGUS'' must be declared". ' ||
2566+
'Exception raised by: "begin wt_assert.bogus; end;".' );
25642567
-------------------------------------- WTPLSQL Testing --
25652568
throws (
25662569
msg_in => 'THROWS Varchar2 Test',
@@ -2571,12 +2574,9 @@ $THEN
25712574
msg_in => 'temp_rec.last_details value',
25722575
check_this_in => temp_rec.last_details,
25732576
against_this_in => 'Expected exception "%PLS-00302: component ''BOGUS'' must be declared%". ' ||
2574-
'Actual exception raised was "' ||
2575-
'ORA-06550: line 1, column 17:' || CHR(10) ||
2576-
'PLS-00302: component ''BOGUS'' must be declared' || CHR(10) ||
2577-
'ORA-06550: line 1, column 7:' || CHR(10) ||
2578-
'PL/SQL: Statement ignored". ' ||
2579-
'Exception raised by: "begin wt_assert.bogus; end;".');
2577+
'Actual exception raised was "ORA-06550: line 1, column 17:' || CHR(10) ||
2578+
'PLS-00302: component ''BOGUS'' must be declared". ' ||
2579+
'Exception raised by: "begin wt_assert.bogus; end;".' );
25802580
-------------------------------------- WTPLSQL Testing --
25812581
throws (
25822582
msg_in => 'THROWS Number Test',
@@ -2586,13 +2586,10 @@ $THEN
25862586
wt_assert.eq (
25872587
msg_in => 'temp_rec.last_details value',
25882588
check_this_in => temp_rec.last_details,
2589-
against_this_in => 'Expected exception "%-00302%". ' ||
2590-
'Actual exception raised was "' ||
2591-
'ORA-06550: line 1, column 17:' || CHR(10) ||
2592-
'PLS-00302: component ''BOGUS'' must be declared' || CHR(10) ||
2593-
'ORA-06550: line 1, column 7:' || CHR(10) ||
2594-
'PL/SQL: Statement ignored". ' ||
2595-
'Exception raised by: "begin wt_assert.bogus; end;".');
2589+
against_this_in => 'Expected exception "%-00302%". ' ||
2590+
'Actual exception raised was "ORA-06550: line 1, column 17:' || CHR(10) ||
2591+
'PLS-00302: component ''BOGUS'' must be declared". ' ||
2592+
'Exception raised by: "begin wt_assert.bogus; end;".' );
25962593
-------------------------------------- WTPLSQL Testing --
25972594
wt_assert.g_testcase := 'Raises Tests Happy Path 3';
25982595
raises (

0 commit comments

Comments
 (0)