QTP automated testing on .net application
Hello all,
I was wondering if someone could possibly shed a bit of light on the current problem i am having with my automated testing
When recording a test on our system (Insight) to click on some drop down menu's on a policy application box, the lines of code recorded are as follows:
VbWindow("MDIMain").VbWindow("[COLOR="red"]frmClientFastTrack_11[/COLOR]").VbWindow("frmPolApp").VbFrame("fra(0)").Click 108,98
VbWindow("MDIMain").VbWindow("[COLOR="Red"]frmClientFastTrack_11[/COLOR]").VbWindow("frmPolApp").ActiveX("xComboList.xCombo").VbComboBox("cmbList").Select "Combined"
VbWindow("MDIMain").VbWindow("[COLOR="red"]frmClientFastTrack_11[/COLOR]").VbWindow("frmPolApp").VbFrame("fra(0)").Click 39,84
VbWindow("MDIMain").VbWindow("[COLOR="red"]frmClientFastTrack_11[/COLOR]").VbWindow("frmPolApp").VbComboBox("cboPlanType").Select "Commercial Combined "
VbWindow("MDIMain").VbWindow("[COLOR="red"]frmClientFastTrack_11[/COLOR]").VbWindow("frmPolApp").Click 367,200
VbWindow("MDIMain").VbWindow("[COLOR="red"]frmClientFastTrack_11[/COLOR]").VbWindow("frmPolApp").VbComboBox("cboSaleMethod").Select "Internet "
VbWindow("MDIMain").VbWindow("[COLOR="red"]frmClientFastTrack_11[/COLOR]").VbWindow("frmPolApp").Click 344,227
VbWindow("MDIMain").VbWindow("[COLOR="red"]frmClientFastTrack_11[/COLOR]").VbWindow("frmPolApp").Dialog("APPLICATION FORM").Click 122,29
VbWindow("MDIMain").VbWindow("[COLOR="red"]frmClientFastTrack_11[/COLOR]").VbWindow("frmPolApp").Dialog("APPLICATION FORM").WinButton("OK").Click
The problem i am having is with the areas in red, each time the test is performed and a new client and policy application box is opened the number after the underscore increases by 1 digit, thus causing qtp to stop.
if the line of code is re-recorded the number on the above line of code has increased by 1 digit again.
My question really is, is there a way to allow qtp to consistently recognize the drop down boxes and ok button each time the test is run?
any help would be greatly appreciated.
regards James.
Re: QTP automated testing on .net application
Have you tried substituting that part in the OR with a regular expression?
Re: QTP automated testing on .net application
Im not quite sure what you mean by that.
Please could you elaborate or give an example of how i would go about substituting with a regular expression?
regards James
Re: QTP automated testing on .net application
I think you should change the mandatory property QTP learn for window during recording or one more solution is add assistive property to learn by QTP for vb window.
And one more solution can be delete the name property of the object in OR and add some other reliable property to identify that window.
I am sure it will help you.
Let me know, whether you get the solution and how?
Re: QTP automated testing on .net application
You can replace everything after the underscore with a wild card (.*) if you are using DP. If you are using OR, you can just subtitute [0-9]+ instead. Like this:
frmClientFastTrack_[0-9]+
Remember to check Regular Expression in the dialog when you are doing this. This may be the best solution in your case. You can also try this (using DP):
VbWindow("MDIMain").VbWindow("title:=frmClientFastTrack.*").VbWindow("frmPolApp").VbFrame("fra(0)").Click 108,98
This should work if "frmClientFastTrack_11" is the title of your VbWindow.
Re: QTP automated testing on .net application
Thanks for all your replies to this.
I shall try and modify my scripts now and let you all know how i get on.
thanks once again.
James.
Re: QTP automated testing on .net application
[QUOTE=Anshoo_Arora;28589]You can replace everything after the underscore with a wild card (.*) if you are using DP. If you are using OR, you can just subtitute [0-9]+ instead. Like this:
frmClientFastTrack_[0-9]+
[/QUOTE]
I used the above advice and it has finally progressed my testing forward.
thanks you very much for your help.
James.