Hi,
I am using:
QTP 9.5 with: TestAdvantage for Windows Forms (HP) Version 2007 Vol. 3 CLR2.0
Application under testing has: NetAdavntage 2007 Vol. 3 CLR 2.0
I am automating an application where i need to select "Connect" option from file menu. I have written the following code.
SwfWindow("swfname:=xyz").SwfToolbar("swfname:=xyz").ClickToolbarTool "MenuBar","File" wait(2) SwfWindow("swfname:=xyz").SwfToolbar("swfnamexyz").ClickMenuTool "MenuBar,File","Connect"
This code works fine normally. But during execution of the script. if user interfare (moves the mouse during Run Time), some times the drop down menu is unable to appear and the script gets failed.
It happens for Context Menus too. When Right clicked at any node of a tree, and then clicking at the Context Menu items, sometimes during Replay, if user moves the mouse pointer then the script fails.
Can any body please suggest me any suitable alternative.
Also note that there is no toolbar buttons for connect and disconnect option hence i have to use only File menu.
Please help in this as it's an urgent issue.
Thanks,
Nabajyoti
Hi Ryan/Ammar
Thanks to you guies for your valuable advice. This will help me to convince the upper level concern.
Thanks a lot again.
regards,
Hi Nabajyoti
Ryan is totally right, using the mouse or keyboard during script playback is not a good idea. so you might want to run the script on a devoted machine. or at least on a Virtual machine where it has its own virtual input devices
Regards,
Ammar
I do think it is good practise to prevent any other sort of input on the computer when an automated test is running, particularly a GUI-based test. I have certainly come across the problem you are experiencing when performing menu clicks. Preventing user interference will definitely get rid of your problem.
Thanks a lot Ryan for your valuable suggestion. Ofcourse the keystoke is the best alternative, but unfortuately the application that i am automating do not support short key stroke to connect/disconnect, neither there is a toolbar button. The only way is to click File menu then click connect/ disconnect. And in certain other steps the context menu by rightclicking.
Do you think I must stop user interfare during script run. or is there any possibility?
Thanks
nabajyoti
When I have had an issue with a menu item in the past (for example when QTP recorded a click on a particular menu item in an app I was working on, the menu item name returned was a massive long number - similar to a GUID - that changed evey time the appalication was opened), I have found that using keystrokes instead was a very stable alternative.
For example, to open your connect menu it might look like:
SwfWindow(oWin).Type micAltDwn + "c" + micAltUp
That's assuming your menu items use keyboard shortcuts. I don't think you should be letting a user move the mouse during a test run anyway, and we have a dedicated computer for running automated tests to guarantee that doesn't happen.
Cheers, Ryan