cancel
Showing results for 
Search instead for 
Did you mean: 

Closing all the windows if it fails and continue the tests

SOLVED
Contributor

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

 

1 ACCEPTED SOLUTION

Accepted Solutions
Contributor

Re: Closing all the windows if it fails and continue the tests

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

7 REPLIES 7
Community Hero

Re: Closing all the windows if it fails and continue the tests

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...


Robert Martin
[Community Expert Group]
Please consider giving a Kudo if I write good stuff
----

Why automate?  I do automated testing because there's only so much a human being can do and remain healthy.  Sleep is a requirement.  So, while people sleep, automation that I create does what I've described above in order to make sure that nothing gets past the final defense of the testing group.
I love good food, good books, good friends, and good fun.

Mysterious Gremlin Master
Extensions available
Contributor

Re: Closing all the windows if it fails and continue the tests

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

Community Hero

Re: Closing all the windows if it fails and continue the tests

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.


Robert Martin
[Community Expert Group]
Please consider giving a Kudo if I write good stuff
----

Why automate?  I do automated testing because there's only so much a human being can do and remain healthy.  Sleep is a requirement.  So, while people sleep, automation that I create does what I've described above in order to make sure that nothing gets past the final defense of the testing group.
I love good food, good books, good friends, and good fun.

Mysterious Gremlin Master
Extensions available
Contributor

Re: Closing all the windows if it fails and continue the tests

Dear tristaanogre,

 

Thankyou, even I have used the same thing in my routine.

For example: Close button test , if I click on the close button and satisfied the conditon it's fine but  incase it not satisfies then  I can't use the obj.Close() options right.

 

Rough Code:

if action == '"close":

    if  not  obj.Exists:

          Log.CheckPoint()

    else:

         Log.Error()

         obj.Close() ## Here I can't use the same option which I am checking right ?

elif action == "no"

     if not obj.Exists:

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

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

..........

 

Did you get my point now ?

 

thanks and Regards

SivaKartheek Sreeram

 

 

 

 

   

   

 

Highlighted
Community Hero

Re: Closing all the windows if it fails and continue the tests

Yup, got the point... my answer does not change.  I think you're handling this the best you can.  


Robert Martin
[Community Expert Group]
Please consider giving a Kudo if I write good stuff
----

Why automate?  I do automated testing because there's only so much a human being can do and remain healthy.  Sleep is a requirement.  So, while people sleep, automation that I create does what I've described above in order to make sure that nothing gets past the final defense of the testing group.
I love good food, good books, good friends, and good fun.

Mysterious Gremlin Master
Extensions available
Contributor

Re: Closing all the windows if it fails and continue the tests

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

Community Hero

Re: Closing all the windows if it fails and continue the tests


@sivakarthik wrote:

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


That's actually a valid solution... generally, does the rest of the test case make sense to continue if a fundamental step fails?  IMO, I usually do the same...  Doesn't make sense to continue a test of an earlier condition fails as it could make any other results invalid.

 

Glad to help!


Robert Martin
[Community Expert Group]
Please consider giving a Kudo if I write good stuff
----

Why automate?  I do automated testing because there's only so much a human being can do and remain healthy.  Sleep is a requirement.  So, while people sleep, automation that I create does what I've described above in order to make sure that nothing gets past the final defense of the testing group.
I love good food, good books, good friends, and good fun.

Mysterious Gremlin Master
Extensions available
New Here?
Join us and watch the welcome video:
Top Kudoed Authors