Humble Trader

Monday, February 06, 2006

PL/SQL Package Test Script

Paste this code into a .sql script and run it in SQL*PLUS by the owner of the target schema.

SET SERVEROUTPUT ON SIZE 1000000;

-- Test pk_package:
DECLARE
l_...
l_passed BOOLEAN := TRUE;
BEGIN
dbms_output.put_line('-');
dbms_output.put_line('FUNCTION function test start:');
dbms_output.put_line('-');
dbms_output.put_line('Initialise:');

-- Initialisation code.
...

dbms_output.put_line
('Test 1: Pass ...: Description.');
dbms_output.put_line
('Expected result: ...');
l_... := pk_package...(...);
dbms_output.put_line('Result = ' || l_...);
IF l_... = ...
THEN
dbms_output.put_line('---PASSED---');
ELSE
dbms_output.put_line('---FAILED---');
l_passed := FALSE;
END IF;
dbms_output.put_line('-');

dbms_output.put_line('FUNCTION function test end:');
dbms_output.put_line('-');

dbms_output.put_line('-');
dbms_output.put_line('PROCEDURE procedure test start:');
dbms_output.put_line('-');

dbms_output.put_line
('Test 1: Pass ...: Description.');
dbms_output.put_line
('Expected result: ...');
pk_package...(l..);
dbms_output.put_line('Result = ' || l_...);
IF l_... = ...
THEN
dbms_output.put_line('---PASSED---');
ELSE
dbms_output.put_line('---FAILED---');
l_passed := FALSE;
END IF;
dbms_output.put_line('-');

dbms_output.put_line('PROCEDURE procedure test end:');
dbms_output.put_line('-');

dbms_output.put_line('Clean up:');

-- Clean up code.
...

dbms_output.put_line
IF l_passed =TRUE
THEN
dbms_output.put_line('---PASSED---');
ELSE
dbms_output.put_line('---FAILED---');
END IF;

dbms_output.put_line('-');
END;
/

0 Comments:

Post a Comment

<< Home