Forum Discussion
All the time.
It's a common automated testing problem.
I have validation routines that check for existence and visibility of pretty much any object a script is about to use. If it doesn't come back as TRUE (exists & visible on screen), then I can't use the object and log some sort of error message instead.
I use the same routine to check the opposite condition as well. ie. to make sure an object that's expected to vanish has actually vanished.
The routine takes in:
- An object locator reference.
- Whether the object should be present or not.
- How long to wait for that condition to be achieved.
It's one of the most heavily used routines in my scripts. Without it, things would fail, crash, and get in a total mess all over the place. And one of the top priorities for ANY automated test for me is that it is almost impossible to crash it. If I'm running 8 hours worth of automated tests, I don't want to be having to check if it's crashed every 20 minutes.
Robustness. Robustness. Robustness.
It's so important I said it three times. :smileyhappy:
- tristaanogre8 years agoEsteemed Contributor
Preach, Colin_McCrae
SumanthKotha get VERY familiar with built in methods like "WaitChild" or "WaitAliasChild" or "WaitProcess" as well. These are VITAL to that robustness that Colin mentions when it comes to testing existence of an object. Just checking "Exists" on an object will generate warnings and errors if the object does not exist... using "WaitChild('ObjectName').Exists" takes care of that.
Learn them. Use them. Love them.
- SumanthKotha8 years agoOccasional Contributor
Colin_McCrae and tristaanogre Thanks for info. Actually in my scenario, the application is developed in Java and a window is there where it was recognized for the first time and i did all my operations which i want to do, later i have button call "Next" which takes the same window to loaded with different objects, here also i was able to do all the operations which i want to do, now in this window i have "Back" button, once i click, it load the previous objects into the window now this time the same objects which was recognized earlier now its saying not able to recognize. i tried to declare the page objects again (thinking the old variables values might have become null when i move NEXT and BACK).
- Colin_McCrae8 years agoCommunity Hero
Are these mapped objects we're talking about?
It sounds like one of the reference properties you're using to identify your object is changing. Which is quite possible. And I've noticed Dialog/Alert type boxes can be especially bad for this.
Have you inspected it at the point it stops working and compared the properties at the time with those at the point it breaks?
The other possibility is that one of it's parent objects has done this (changed identification property) so isn't being recognised.
What properties are you using? The ones the system captures at the point you map it are all well and good as a starting point, but are by no means guaranteed to be reliable in the long term. Most things will require some manual tweaking to make them robust.
Related Content
- 7 years ago