We are using QTP 10 on an application that was upgraded to NetAdvantage for .Net 2008 Vol. 2 CLR 2.0 from NetAdvantage 2006 Vol. 2 CLR 1.x and have a couple of instances when we're getting the following run error: "An existing connection was forcibly closed by the remote host."
The first instance occurs during a simple action that closes the application by selecting Exit from the File menu. Here is the code from the action:
SwfWindow("Company").SwfToolbar("_frmConsole_Toolbars_Dock_Area").DropdownToolbarTool "PCGCON:Menu","PCGCON:File"Wait 1SwfWindow("Company").SwfToolbar("_frmConsole_Toolbars_Dock_Area").ClickMenuTool "PCGCON:Menu,PCGCON:File","PCGCON:Exit"
The second instance occurs when clicking the Cancel button on an SwfWindow. Here is an example of that code:
SwfWindow("frmSplash").SwfWindow("The following applications").SwfButton("Cancel").SetFocusSwfWindow("frmSplash").SwfWindow("The following applications").SwfButton("Cancel").Click
The first error does not occur consistently, but the second error does. We've tried re-recording the actions in QTP 10, but the errors still occur. Neither error occurs when the actions are executed on QTP 9.2 (we have the corresponding versions of TestAdvantage for both versions of NetAdvantage), nor when you perform the steps manually. There is a work-around for the first instance, but there is not a work-around for the second instance as there is no other way to cancel the window.
I'm at a loss as to what is causing the error, so any insight anyone can provide will be appreciated.
Hi Dennis,
The error in question is triggered when the test object is disposed in the middle of the executing a QTP action. This typically happened in more complex actions, such as SetInvalidDataCell of the Grid, where there are many internally steps that are done, and the application is unexpectedly closed in between those internal steps. I've tried reproducing this in local samples but wasn't able to, I am recommending our developer support to contact you about this to look into this deeper for you, if you have a simple sample that reproduces the behavior that they could look at it would greatly help them in aiding you with the issue.