Toad World® Forums

Performance with large packages with many test cases


#1

Hi guys,

I was creating different kinds of test cases to a package, which includes several procedures. Each procedure includes around three different test cases, which each has diffrent kinds of customizations to db etc. Thing that I noticed after few test cases, is that performance to run these cases withing same package is getting all the time slower. Well of course that’s normal thing to happend, when there’s more and more stuff to do in this package. When I’m having about three test cases in seven procedures in same package, I’m not very enthusiastic to create anymore new test cases for this procedure. When I run new test case it runs anyways all earlier created ones which takes a long time.

The question would be then, is there any easier way to get other test cases within package deactivated, then just clicking all one by one? Is there any possibilities to run only those cases, where one has done modifications or only newly created ones?


#2

It worries me to hear that you are reluctant to create new tests. The numbers you described are not that great, compared to test definitions that I have seen others build. Can you please tell me in more detail what your experience is? How long does it take to generate a package, to simply run a test? What are your tests doing? Are you working with large datasets (tables with many rows)?

As for deactivating test cases, we have on our ER list a plan to make it easy to only execute tests that failed the last time, but we are not there yet. In the meantime, you can activate/deactivate through the PL/SQL API or even by a direct update to the underlying tables.

A unit test will only be tested if its qu_unit_test.testing_status column = ‘Y’. Same with qu_test_case.testing_status and qu_outcome.tsting_status.

Here are the API programs:

qu_unit_test_xp.set_active/set_inactive
qu_test_case_xp.set_active_status

Note that after changing these status values, you will need to explicitly generate new test code.

Another approach you can take is to put code in the conditional execution fields for unit tests and test cases. That way, you can include a single function call that returns TRUE or FALSE. That way, you can change whether or not a test will run with out having to regenerate the test code. You can find more information about this technique in the Help doc, just search for “conditional.”

So please give me some more information and hopefully this helps.

SF


#3

Thank you for your answer. It helped me already at this point to understand little bit more about Code Tester. To get back to this problem I faced, I’ll write a small example of set up. So I have a package x. This package controls lower lever inserts, updates, checkings, different kind of things. To be able to to this kind of inserts there needs to be done upper level inserts, which are controlled by external program, that I call from different schema at customization initialization for this test code part. For some updates I have also created dummy inserts in pre-execution code. I basically need to do these same initialization calls for each test case individually, which probably is the reason that takes time. Could there be a way to do customize initializations for whole package, which would then be used for as global initialization for all package procedures? To get back to this example. So I have in this one package now eight procedures and total number of test cases, which each do same initializations 16 very basic test cases. When I started to do these tests time to run took around 2 seconds with all initializations etc. Now that there’s many test cases, it takes every time, when I run and test how my test case worked almost 2 minutes. Because of this I was thinking, how could I for example deactivate these other cases within this one package, so I would basically run only one test case and not all. Reason for slow performance is most surely these initializations not Code Tester, but running all cases within one package makes it heavy and time consuming. I would like to do these new test just quickly and let other sources do reporting for all cases.

Hope this helps to understand what I’m meaning. Dont’ worry I’m not reluctant to create new tests. I have plenty other packages =)


#4

I am glad that the base Code Tester is not at the heart of the performance issues. You can certainly perform global initialization, simply by executing the setup code at the test definition level, via the customization tab in Test Editor (click on Properties at the top of the browser, and then the Customization tab on the right). This will run once when the tests start, but not for every test case. You can also run a single test case or single unit test from within Test Editor. Simply right click on that item and instead of choosing “Run Test”, choose “Run Test Case” or “Run Unit Test”. You can also restrict which tests you run through the PL/SQL API for command line test execution.

Does this address your problem?

SF


#5

Hi,

Thank you for your reply. These where just what I was looking for. I didn’t realize, there was at Test Editor those possibilities and I always did customizations at Test Builder. Also running one by one is now possible that way which saves me lot of time. I’ve been just using Test Builder to run test cases and didn’t even realize there was other ways those at Test Editor. PL/SQL API side I haven’t yet tested but probably I’ll get familiar with that later on.