Forum Discussion

BVS's avatar
BVS
Occasional Contributor
5 years ago

How to determine that test was interrupted?

Hello community!

 

I need to get value "test interrupted" or "test completed" when OnStopTest event is triggered.

I try to get it from log message "The test execution was interrupted.", but sometimes message appears after OnStopTest event is ended.

OnLogError event does not triggered after OnStopTest event.

To add mark at the end of each test not conveniently.

Anybody knows another solution?

  • AlexKaras's avatar
    AlexKaras
    Champion Level 3

    Hi,

     

    Technically, to add some mark at the end of each test is the only solution that I can think of at the moment.

    However, IIRIC, interrupted test is marked red, as the failed one (which, technically, is the same).

    Can you describe your use case that requires to distinguish between interrupted and failed test?

     

    • BVS's avatar
      BVS
      Occasional Contributor

      Hi AlexKaras 

       

      I automatically transfer test result in test management system by API when OnStopTest event is triggered.

      Currently when I interrupting Keyword test it continues to stay green. It is wrong information for test management system and I do not need to transfer it. Test will marked red only after OnStopTest event is ended. But after that is no way automatically transfer result to test management system.

      • AlexKaras's avatar
        AlexKaras
        Champion Level 3

        Hi,

         

        Hm... Well, I see...

         

        I never checked it, but if you don't mind:

        -- This  "The test execution was interrupted." message - is it of Error type?

        -- If it is, then I would expect it to trigger the OnLogError event;

        -- I would expect that this OnLogError event is triggered before the OnStopTest one.

        If all above expectations are correct, then you can utilize the OnLogError event to set a flag that the test is interrupted and use this flag in the OnStopTest event handler to make a decision of whether or not the test was interrupted. OnStartTest event can be used to reset the flag.