December 2010
Intermediate to advanced
451 pages
11h 16m
English
You have a PL/SQL object that you'd like to test to verify it returns the expected values.
Create a utPLSQL test package to test every code branch and computation within your function. Use utPLSQL assertion statements to test every foreseeable use case for the function. For example, suppose you wish to test a simple factorial function that contains four code branches, each of which returns a value. Here's the target function:
CREATE OR REPLACE FUNCTION factorial (fact INTEGER) RETURN INTEGER is
BEGIN
IF fact < 0 THEN RETURN NULL;
ELSIF fact = 0 THEN RETURN 1;
ELSIF fact = 1 THEN RETURN fact;
ELSE RETURN fact * factorial (fact-1);
END IF;
END factorial;
Next, create ...
Read now
Unlock full access