Toad World® Forums

How to test several cursors inserts and updates squashed into one procedure


I have been encountering a problem of how to test large procedures, which contain high amount of different kind of actions. There might be for example several cursors, which are then used to insert data into many different locations and after those some updates. Should these be separeted into several smaller functions/procedures and then call in one place or is there any other possibility to recognize, that this test case tests second cursor of this procedure and this third insert in this procedure? In test builder I haven’t been able to specify, which one of multible things in one procedure I could test.


First of all, for any procedure you can create as many outcomes as you would like. So if your procedure modifies 10 tables, you can/should create 10 outcomes, one for each table. Each test case could test each of these outcomes, or you could isolate different tests against tables in different test cases. That’s up to you.

So there should be no constraint within CT and Test Builder to test procedures of arbitrary complexity.

It would make sense, however, to break that large procedure up into smaller, simpler modules and then build smaller, simpler tests for each of those modules. You don’t have to do this, but it will generally make your programs easier to build, test and maintain.

Does this help?