Toad World® Forums

How can I provide non-fixed values in my testing, such as data from a table


#1

From Marko:

We don’t like writing fix values in your tool for input parameters and than again in result queries because of great probability of mistyping. We save value of procedure parameters in table. So if we have procedure mypack.myproc(p_id in number) where p_id is id of same table, it is more likely that we will need to use that id in our result in the part “Data changed by program”. Normally we have all the data in table rows, so we send only id to procedure that make changes in some rows in tables which are restricted by that id.

Is there any option that you upgrade your program with this functionality?


#2

Marko,

Two things:

  1. You can put test data values in a table and then specify a SELECT statement as the “value” of your input (this works for scalars only at this time). Simply press the […] button on the right of the input grid in Test Builder. You will see a radio group at the top of the window. Select the “Customize your own test data group” option. Then press the SQL Query radio group item and enter your query. If you want to use this same query for other inputs, then use the Test Data Manager from the Dashboard to create a named test data group for this query.

  2. If you want to reference directly an input parameter value in your outcome, then open up the Test Editor for that definition and navigate to the Input. The properties tab will show the name of the variable that we will use for that argument. Use that in your outcome grid. If, however, you want to reference that variable in a query, then if you have any problems with compiling the test definition (remember: the variable is not defined until we run the test definition), then check out the help doc topic:

How do I…Reference IN Argument Values in my Outcomes.

Hope this helps,

SF

Message was edited by: unittestadmin


#3

I attach a picture the way we use it right now. We declare for example pb_vpo so we can use it later in “2b. inputs” and in many defined “2c. Outcomes”. We declare this because this is only one test case, but when we test our package procedure we create many test cases with the same outcomes. We check only tables values.

What we would like is, if we can use p_vpo instead of pb_vpo, without declaring it in “Declarations” for example in outcomes.

so if i write in “2b. inputs” for p_vpo value 100, i would like to use it in “2c. Outcomes” like “select … where id = p_vpo” instead of “select … where id = 100”
globals.jpeg


#4

marko,

In Code Tester today, you cannot reference p_bvo directly - that is a formal argument and is not declared anywhere as a variable to reference.

Instead, you could use this:

qu_result_xp.argval_number (‘p_vbo’)

and will obtain the value for you. So I think we give you what you want right now. Is this not the case?

Thanks, SF


#5

qu_result_xp.argval_number (‘p_vbo’) is exaclty what i need.

Thank you.