Forum Discussion

KSQian's avatar
KSQian
Contributor
7 years ago
Solved

Test end event/trigger

Hi all,


I may be asking the wrong questions so I'll just explain what I'm trying to do:

 

When a TestComplete completes running, I am having it go to an url, which is basically a REST api to trigger the next run (we built an internal web app to queue tests). 

 

So first, I tried putting this rest api trigger at the end of a script. But that's not good enough - because in the event the run gets some exceptions, I dont get to the api part.

 

So next, I tried to use a try-catch block to catch any exceptions. If exception, then trigger api. This is slightly better, but what if a run is not going as expected and someone ends the run manually.

 

I need a general way to say, if this test complete run finishes, do this.

 

7 Replies

    • KSQian's avatar
      KSQian
      Contributor

      Thanks! That seems to do the trick.

       

      Seems like the event code doesnt work unless I add in an actual event to the project. If only there's a code-only solution... 

       

      But thats okay! This will do for now. 

      • tristaanogre's avatar
        tristaanogre
        Esteemed Contributor

        A code only solution would be try/catch/finally.... in the "Finally" block, trigger your code.  Finally will run ALWAYS... if there's an exception, "catch" will run... then "finally" runs.  If there is no exception, the "catch" block is ignored but "finally" still runs.