Toad World® Forums

Test argument or return value populated by sequence


#1

A user asked for help regarding: “My procedure populates an OUT parameter from a sequence. I want to make sure that it was populated correctly. I can’t predict the exact number, but I could at least check for something like value BETWEEN sequence + 1 AND sequence + 100. How can I do this in Code Tester?”

This calls for an Expression outcome! To demonstrate, I create a sequence and procedure

CREATE SEQUENCE temp_seq
/

CREATE OR REPLACE PROCEDURE test_seq_value (val_out OUT INTEGER)
IS
BEGIN
val_out := temp_seq.NEXTVAL;
END;
/

Then I create a test case for test_seq_value and choose as my outcome type: Expression.

Then in my expression window I set the datatype to Boolean and the expression to:

P_VAL_OUT BETWEEN 1 AND temp_seq.CURRVAL + 1

or whatever variation you want to use.

Then I run the test and it works!

Now, you might wonder how I knew to use “P_VALUE_OUT” in the expression. That’s the name of the variable that is populated by the call to the procedure. I found that out by clicking on the Program Call tab in the Test Editor (or Test Builder), once I zoomed down to the outcome.

Hope this helps!
Cheers, SF