Toad World® Forums

Going bananas


Hi all,

A newbie asking newbie questions here.

Let’s say I write software that (virtually) stores fruit in fruit boxes for customers.

I’ve got a function called the_right_box. In goes the fruit name and out goes the fruit box name. Eg: ‘apple’ goes in and ‘apple box’ goes out. The fruit-fruitbox combinations are hardcoded. Then I could write the following hardcoded test cases:
‘apple’ - ‘apple box’
‘banana’ - ‘banana box’
‘cherry’ - ‘cherry box’

But now, the software has become highly configurable. And conform a specific configuration it could be that apples ought to go into the banana box, bananas into the cherry box and cherries into the apple box. And in every environment (three software versions in the market, all with some development and test environments) the configuration is likely to be totally different. So you have to query the current configuration and use that as your input values and expected outcome values. The query could be looking like this:
SELECT fruit, fruitbox FROM configuration - where ‘fruit’ contains the input values and ‘fruitbox’ the expected outcome values. From my one day evaluation experience I think it’s possible to setup such test cases using Quest Code Tester. So far so good.

Q1:How can I setup such test cases using Quest Code Tester?

With examples 1 and 2 I was just testing fruit and fruitbox types, but not their instances. Let’s say my software consists of a bunch of object instances representing my customers and with each customer I could define some fruit instances and fruit box instances. My the_right_box function has now been changed into a function with a fruit instance sequence going in and a fruitbox instance sequence going out. Whether the apples are going to be stored in an apple box is now not only depending on the general configuration, but also on the current situation with a certain customer. If customer ‘Fruits Ltd’ has 12 apples and 0 apple boxes, 1 banana box and 1 cherry box, then the function can’t possibly return an apple box sequence. In this testcase it should return a minus 1 for an apple sequence, for not being able to find the apple box needed.

Q2:How could I set up test cases for this?

First of all I guess I have to set up a test situation, using some PL/SQL, with modules like create_test_customer(name), create_test_fruit(customer, type_of_fruit, number), create_test_fruit_box(customer, type_of_fruit_box, number). But the number of fruit, the number of fruit boxes, the fruit types and the fruitbox types are all depending on the specific test case.

Secondly, I guess again, the test case has to do a query like the one below to actually get some input and expected output values:
FROM customer, fruit, fruitbox
WHERE = fruit.fruit2customer
AND = fruitbox.fruitbox2customer
AND (fruit.fruit_type_id, fruitbox.fruitbox_type_id) =
–The global fruit - fruitbox configuration
SELECT c.fruit_type_id, c.fruitbox_type_id
FROM configuration c
WHERE c.fruit_type_id = fruit.fruit_type_id
AND c.fruitbox_type_id = fruitbox.fruitbox_type_id

Q3:How can this kind of test situation setup be integrated with the actual test cases within Quest Code Tester?

Kind regards,

(let me know if you need more fruit)


Sorry about the delay, Mark. I have been on holiday…

Q1: It sounds to me like you want to provide a fixed input value, “apple”, but your expected outcome value must be based on a query. You could write a function that returns the value (hiding the query inside the function), and then call that function for the expected value (mark that value as “Evaluate as an expression” in the Properties window, which comes up when you press the […] button).

But the easiest way to do that is to use one of our helper functions (1.6 and above), as in:

qu_helper.string_column_value (,



qu_helper.string_column_value (USER, ‘employees’, ‘last_name’, 'department_id = 10)

How does that sound?

Q2: I am not sure what the issue is here. Generally, you will need to provide a set of inputs that lead to predictable outcomes. If your function returns an integer, you can certainly check to see if -1 is returned for a set of inputs. But I think you mean something different. Please clarify.

Q3: First, you can call and even create all of your setup logic in the customization sections, some of which are available in the Test Builder, all of which are available in the Test Editor. So build your functions and then call them in the appropriate initialization section.

But if need to extract input or outcome values from queries, you will simply open up the properties window for the value […] and then click the “Customize your own test data group” radio button. You can then type in the query and this query will be used at test time to populate the item.

Let me know if this helps.



Nevermind the delay, thanks a lot for replying. I would hate seeing somebody not getting enough vacation. I hope you had a good time.

Your answers sound very promising. I have to look into it further later this week before I can say anything about how helpful the answers have been.

But again, it all sounds very promising.




Hey Mark,

I would love to hear if you have made progress with Code Tester!

Thanks, SF


Sorry for the radio silence, Steven!

I think with your help I’ve figured out how I could do anything I want for testing using Quest Code Tester.

Still, if one wants to automate systematic testing, one has to have an idea first of what systematic testing should look like. In my former job, all the testing was based on test cases systematically written out on paper.

In my current job, all the testing is based on on-the-fly testing. And I’m afraid the gap between on-the-fly testing and automated systematic testing is too large. So we’re currently trying to introduce systematic testing based on documents first, taking one step at a time.

If that goes all swell, then perhaps we could take it to another level.




Thanks, Mark. I know exactly what you mean. It IS hard to make the psychological adjustment to systematic testing. I only hope that Code Tester makes it easier to make the transition…