Toad World® Forums

Help with Testing Single Values within Records


#1

I posted this in an old thread, but figured it might need its own since that one was old and answered.

Steven,

I need to test a package that returns a record, but only wish to check one field in the record as well.

I wish to use the method you described:

"I can define an outcome as follows:

Changed by Program
Type of data: Expression

Then in CBP […] I set the datatype to NUMBER and type this in the code area:

“Value From Function”.sal

I can then define the rest of my outcome as a test on this particular scalar value.

Having said all this, clearly we need to provide some better guidance. How are you supposed to know that the name of the variable is “Value From Function”, and so on?

But in the meantime, this should work. "

How, indeed, are you supposed to know the name of “Value From Function”? I tried using the l_result variable, but I could not get it to work right.

Could you elaborate on how you would go about finding the name of the variable? (Perhaps it just involves digging through the generated Test Code or it has a standard varable name?)

Thanks for the help,

Josh


#2

To find the name of the variable holding the value returned by your function, navigate to the list of Test Elements for your program, in the Test Editor.

Expand that list and click on the item named

[Funcion return value]

In the Properties tab you will see a field named

Default variable name

That is the default value, which is currently

Q##FUNCTION_RETURN_VALUE

I hope this helps.

SF