Forum Discussion

dmitri_1's avatar
dmitri_1
Occasional Contributor
11 years ago

Post/After Operations

Is there any way in testComplete to have an operation that happens after the test (regardless of pass or fail)?



E.g. Quit Application.





6 Replies

  • dmitri_1's avatar
    dmitri_1
    Occasional Contributor
    Yep it did.



    But can you control exactly which tests run this under the KeywordTests folder?



    Or will it just run after every test.



    Because I would want different actions for each testcase...
  • It's an event, so it'll be fired every time. What you can do is have OnStopTest have the logic for what to do when it's called based on what test is stopping.



    For example:



    Sub GeneralEvents_OnStopTest(Sender)

      if project.variables.currenttest = "test1" then

        'do something

      else

        'do something else

      end if

    end sub
  • AlexKaras's avatar
    AlexKaras
    Champion Level 3
    The project variable from Joe's sample can be assigned value using the Keyword operation, but the body of the event handler must be coded.
  • dmitri_1's avatar
    dmitri_1
    Occasional Contributor
    Alright, sounds like a bit of a (unnecessary) complication as I was planning to primarily create tests using keywords and not viewing the code.