| |
|
Learn how to test object type methods *indirectly* from within Quest Code Tester
You cannot yet test directly object type methods in Quest Code Tester. You can, however, "wrap" your object type method inside a "regular" PL/SQL procedure or function and then test that program. This tutorial shows you the basic steps for doing so.
Flash tutorial explaining the topic: A brief video that shows you how to use Quest Code Tester to solve the problem posed by this topic. Step-by-step instructions: Follow these steps to replicate what we show you in the tutorial. We don't offer any step by steps on this one. We simply show you the technique for "wrapping" your object type method behind a good, old procedural subprogram.
Source code of program tested: Compile this code in your schema so that you can build your test definition for it. CREATE OR REPLACE TYPE qctod#name_type IS OBJECT (
firstname VARCHAR2 (20)
, lastname VARCHAR2 (20)
, MEMBER FUNCTION full_name (SELF IN OUT qctod#name_type)
RETURN VARCHAR2
)
/
CREATE OR REPLACE TYPE BODY qctod#name_type
AS
MEMBER FUNCTION full_name (SELF IN OUT qctod#name_type)
RETURN VARCHAR2
IS
BEGIN
RETURN SELF.firstname || ' ' || SELF.lastname;
END;
END;
/
CREATE OR REPLACE PROCEDURE qctod#object_wrapper (
firstname_in IN VARCHAR2
, lastname_in IN VARCHAR2
, fullname_out OUT VARCHAR2
)
IS
l_object qctod#name_type := qctod#name_type (firstname_in, lastname_in);
BEGIN
fullname_out := l_object.full_name;
END qctod#object_wrapper;
/ |
|