Forum Discussion

kcsahu777's avatar
kcsahu777
Contributor
14 years ago

How to run procedure at begin and end of the total testing

I want to run one procedure P1 at the begining of test and another procedure P2 at end of the test.

Suppose I have 10 test cases. I want to run P1 procedure once before all start of test.

And after completion of all test cases I want to run procedure P2 once. How this will be done?



OnStartTest and OnStopTest events are for each test case. But I want to run at the begin and end of testproject.


  • karkadil's avatar
    karkadil
    Valued Contributor
    The easiest way to do this, is to create 2 additional procedures and place them at the beginning and at the end of the list of Test Items.



    Another workaround is to create one additional function and call all the tests from this function, like this




    function Test()

    {

      Test1();

      Test2();

    }


    and put this function to the Test Items. In this case events OnStartTest and OnStopTest will work exactly as you want
  • Hi,


    You can organize your tests on the Test Items page so that the test engine automatically runs your tests in the needed order. For example, it runs procedure P1 first, then runs your ten test cases, and finally runs procedure P2. For more information, please read Creating Batch Test Runs.