Common mistakes by QTP tester

Below are the items to make sure you include to avoid mistakes

1. Capture screen for failure steps: Many times we ignore this and many a times we end up in unable to reproduce it. Its safe to capture a screenshot and save it in a location for future reference and escalation

2. Improper reporting: One need to report after each and every step such that the report should look like a test case with all steps in detail

3. Type casting: While comparing the expected and actual value, the values have to be converted and both of them should belong to the same data type to get compared. Else the step fails though the value is correct

4. Mandate Else block: For each If statement there should be an Else statement to ensure the coverage of all the flows

5. Using on error resume next: Many a times the errors go unnoticed due to this line. Ensure that you use On error go to 0 after the block where you think the error will not occur. Else, you need to comment this line every time you debug the code to identify theh exact error

6. Using of Exit for and exit loop: One should use these statement liberally to improve the performance of the script

7. Use .exist with a timeout ex. broswer().page().exist(3) to improve the performance

8. Check the qtp run status or error number before reporting it to the custom report like excel or html, else the actual report would be failed but the custom report shows pass

9. Always clear the local object repository while using share repository as the objects in local repository will be given preference and properties would change and script would fail

10. Delete the Browser chache each time you start the execution so that the latest/updated files would be downloaded from the server.
 
11. Use print instead of msgbox so that if you miss to delete or comment it, print wouldnt stop the execution.