Monday, December 29, 2008

QTP Maintenance Run Mode

This is just one of the very simple examples to show how Maintenance Run Mode works. In this example we will change the property value of one of the recorded object ourselves to see how this is handled by Maintenance Run Mode.

1. Open a new test in QTP.

2. Make sure that Calculator is also open. (Start -> All Programs -> Accessories -> Calculator)

3. Start recording and while recording on calculator, just press key 1, then + , then 1 and finally =, so the final recorded code looks like this:

Window("Calculator").WinButton("1").Click
Window("Calculator").WinButton("+").Click
Window("Calculator").WinButton("1").Click
Window("Calculator").WinButton("=").Click

4. Right click on Calculator in the first line of code and choose Object Properties.




5. Object Properties window opens. Click on "View in Repository" button.

6. Object Repository - All Object Repositories window opens.

7. Change Calculator to Calculator1 and click on the Close button (x) on the top right.



8. Now just run the test or Press F5.

9. It will show this below error. Just click on Stop in order to stop the Run.



10. Now choose Automation (Menu)->Maintenance Run Mode.

[This above option runs the test in Maintenance Run Mode.]

11. Now it will Open Maintenance Run Wizard - Object Not Found window. Just click on Point button.

[This provides 2 alternatives:
a. Point to the object in your application. Using this option you can point to the object you want your step to use and then QTP determines how your test needs to change to use that object.
b. The second option is to Add a Comment, as a reminder to fix the failed step later.
]



12. The mouse pointer will take the shape of the hand and only Calculator window will be visible. Just click on the Title of the Calculator window.

13. Object Selection window opens. Click Ok.



14. Maintenance Run Wizard - Change Object Property Values window opens. Click OK.
[This Window suggests that this Wizard will change the property value of “ regexpwndtitle” from Calculator1 to Calculator.]



15. It will open Maintenance Run Wizard - Maintenance Mode Summary. Click Finish.



16. It will Finish running the test and show the Results window as shown below.



Now if you run the test with F5 it should work fine.