| || |
Error handling in QTP
Sometimes my automation scripts throws object not found in the repository.this is because the application slowness. Now whenever I encounter this error,I want my script to execute the log off action which is present in the script. Now Can I perform log off action whenever I get object not found in the repository. If I need to add recovery scenario how can I add the log off action to the recovery scenario.
Thank you for your replies.
How about using synchronization points?
Or increasing default sync time if the overall application response time has decreased.
Select - Resouces > Recovery Scenario manager
Define the trigger - Yours will be "Test Run Error"
Select the error - Yours will be "Object Not Found"
Now you should follow the wizard, you may have to create a function that logs you out and call that function when desired action is requested by the wizard.
You might want to think about alternative approachs to an RS like programmatically wait upto a max wait time for the object(s) to exist or some other method as suggested by Prashin.
Object not found in repository is not due to application slowness. That means you're trying to reference something that is not in your object repository. Likely a typo in your code.
Personally I will always use an explicit wait during any transitions. I prefer to set my implicit waits to near instant, it helps alot in speeding up object recognition, but means you have to handle more wait code in your test or framework.
For example, say you change from one screen to another. My first step after that screen change will be to wait on for the parent window and any grouping containers, so I know I'm on the right screen before proceeding. I like to use the Screen Object pattern. Since all things are organized by screens, the creation of the screen object will wait on the window and containers of the screen to be present before the creation of the screen object is complete. At that point, then the test will continue and most of the elements will most likely be there (with exception of dynamic elements that are added/removed during user interactions)