Tips for testing attributes of object types

Suppose my code is this:


CREATE OR REPLACE PROCEDURE qctod#out_object (

   firstname_in IN VARCHAR2
 , lastname_in IN VARCHAR2
 , name_object_out OUT qctod#name_type
)
IS
   l_object   qctod#name_type := qctod#name_type (firstname_in, lastname_in);
BEGIN
   name_object_out := l_object;
END qctod#out_object;
/

I will then go into Test Builder and take these steps:

qcto_1a.PNG-550x0

We automatically create an outcome based on the object type, but it is of no use, since Code Tester cannot test object types directly. So remove this outcome. Then press the Outcome Wizard and choose Expression:

qcto_1b.PNG-550x0

Then on the next page set up a test of a particular attribute of the type; the name of the variable holding the object instance will be of form p_<argument_name>.

qcto_1c.PNG-550x0

I then create an equality test and type in the string I expect. Finish, and then do this for each attribute, and it should work….

qcto_1d.PNG-550x0

And now I run the test and see:

qcto_1e.PNG-550x0

Start the discussion at forums.toadworld.com