Forum Discussion

Vaisag's avatar
Vaisag
New Contributor
5 years ago
Solved

Setting PostRun method for execution in suit Level

We have a query on how to call a function, at end of project execution/a single unit execution/set of units execution.
Basically, we need to call a generic function at end of our script execution.
Execution mode can be a single Unit/multiple Units/Project suite level.

 

We have tried ‘OnStopEvent’ at Unit level. But, it is getting triggered after each functions execution in that unit and not meeting our expectation, as we need this generic function call only at end of execution.

 

  • There is no such ability to execute at a "suite" level.  Project suites contain projects, not code, so anything you do will have to be managed at a project level.  What I would suggest is write some code that you include as a unit or units in the last project to execute in your suite and call that code at the end.

     

    For our automation work we do here, we actually have two projects that we created whose only purpose is "initialization" and "finalization".  They are generic projects that have no actual test or application interation, simply code to initialize an automation run and finalize a run.  We add those to every project suite as the first and last projects to execute respectively.

     

    This, I believe, is going to be your best answer.

3 Replies

  • tristaanogre's avatar
    tristaanogre
    Esteemed Contributor

    There is no such ability to execute at a "suite" level.  Project suites contain projects, not code, so anything you do will have to be managed at a project level.  What I would suggest is write some code that you include as a unit or units in the last project to execute in your suite and call that code at the end.

     

    For our automation work we do here, we actually have two projects that we created whose only purpose is "initialization" and "finalization".  They are generic projects that have no actual test or application interation, simply code to initialize an automation run and finalize a run.  We add those to every project suite as the first and last projects to execute respectively.

     

    This, I believe, is going to be your best answer.

  • AlexKaras's avatar
    AlexKaras
    Champion Level 3

    Hi,

     

    No way 'out of the box' according to my knowledge.

    Though you might to be able to emulate this depending on how you are going to use it in production. (I.e. not while tests creating/debugging/executing on demand.)

     

    • sonya_m's avatar
      sonya_m
      SmartBear Alumni (Retired)

      Thank you Community!

       

      Hi Vaisag! Has the advice solved your question? Please let us know if you need more help here.