Forum Discussion

sivakarthik's avatar
sivakarthik
Contributor
6 years ago

Closing all the windows if it fails and continue the tests

 

Hello every one,

 

Rough code: 

obj.Close()

if not client.WaitWindow("TMessageForm", "Warnung", 1).Exists:
         Log.Checkpoint("Modification Test 1 - with out .i.o.")
else:
error = "\n"
Log.Error("Modification Test 1 - with out  Fails", error)

 

obj. VCLObject("No").ClickButton()

and do the stuff............

................

cond.......

 

My question is, if the code executes at else condition the pop up window will be exist and I can close it by using yes select and click button but, Iam thinking is there any other way to close the pop-uped windows during the test ?

if so where can i find some examples so that I will learn about it.

 

if anybody have please let me know

 

Thanks and Regards

SivaKartheek Sreeram

 

  • sivakarthik's avatar
    sivakarthik
    6 years ago

    Thanks any way for the info. I got an another idea regarding the issue. i.e If that conditions fails I am stooping the test case not doing the tests further.

     

    thanks and regards

    SivaKartheek Sreeram

  • tristaanogre's avatar
    tristaanogre
    Esteemed Contributor

    You could use the "OnUnexpectedWindow" event handler... but I prefer your method...it's not an "unexpected window", you're expecting it and you need to execute the proper code...

    • sivakarthik's avatar
      sivakarthik
      Contributor

      Dear tristaanogre,

       

      Thank you, Actually I am trying to check the pop-uped window buttons i.e Yes, No and Close. if I click No or Yes or Close Button the pop-uped window has to be closed and basing on the button clicked the main editor will perform according to that action.

       

      What  I am trying to do is , if it fails it will generate error and pop-uped window will not be closed. So, I am trying to close these pop-uped windows and continue the tests.

       

      Did you get my point now ?

       

      can I use these windows as "OnUnexpectedWindow" for fail cases ?

       

      thanks and regards

      SivaKartheek Sreeram

      • tristaanogre's avatar
        tristaanogre
        Esteemed Contributor

        Most windows will also support the "Close()" method or something similar.  Examine the window in Object Spy and see if there is a close method associated with it.  That's what I would attempt to use on a fail... you'd need that anyway in the event handler... but I don't think the event handler is what you should use for this situation.