hlalumiere
13 years agoRegular Contributor
TC9 does not release all refs to process or objects after end of test run.
This is something that is hard top put your finger on, but I strongly suspect TC9 does not properly dispose of all references to the tested application or created objects after a test run is ended. In classic VBScript, garbage collection is automatic, meaning that any references created in a script are disposed of properly after the script has ended by the Windows Scripting Host. This doesn't seem to work properly inside TC9, but was fine in TC8.
To reproduce this, all I have to do is open the tested application, and run a simple script. The script works fine the first time, but fails the second. I realize the script alone won't tell you a whole lot. What this basically does: opens a MDI child form that contains a grid showing a list of transactions, keeps it open and opens a transaction input screen, input a new transaction, save it, close the form, going back to the previously opened form, and verifies that the grid refreshed automatically with the new transaction. If I do all of this manually in the application, everything is fine. The first time TC9 runs the script everything is fine as well. However if I try to run the script again without shutting down the tested application, it fails when it checks the first refresh. Somehow the grid is no longer getting refreshed.
Moreover, once I have run the script once, I can no longer open either screens manually without restarting the app, it's like the application's events are hooked elsewhere. When I do shut down the app, only if I did run a script, I get a Run-time error '91': Object variable or With block variable not set. Again this error never happens when TestComplete isn't involved.
I see similar things routinely in VB.Net while working with old unmanaged ActiveX that do not dispose of references in a healthy modern way, this to me looks like a case where TC hooks into the tested application, but fails to unhook cleanly after it is done, leaving some references going and preventing the application from cleanly disposing of its resources. Again this problem was not visible in TC8, if it did happen it did not interfere with the application in the way it does now.
To make things worse, the two memory profilers I am used to refuse to work while TestComplete is active, so I cannot gather concrete evidence to support my case. Is there any way to force the TestComplete garbage collector to flush all references through script? Something like a .DisposeAll() method somewhere?
To reproduce this, all I have to do is open the tested application, and run a simple script. The script works fine the first time, but fails the second. I realize the script alone won't tell you a whole lot. What this basically does: opens a MDI child form that contains a grid showing a list of transactions, keeps it open and opens a transaction input screen, input a new transaction, save it, close the form, going back to the previously opened form, and verifies that the grid refreshed automatically with the new transaction. If I do all of this manually in the application, everything is fine. The first time TC9 runs the script everything is fine as well. However if I try to run the script again without shutting down the tested application, it fails when it checks the first refresh. Somehow the grid is no longer getting refreshed.
Moreover, once I have run the script once, I can no longer open either screens manually without restarting the app, it's like the application's events are hooked elsewhere. When I do shut down the app, only if I did run a script, I get a Run-time error '91': Object variable or With block variable not set. Again this error never happens when TestComplete isn't involved.
I see similar things routinely in VB.Net while working with old unmanaged ActiveX that do not dispose of references in a healthy modern way, this to me looks like a case where TC hooks into the tested application, but fails to unhook cleanly after it is done, leaving some references going and preventing the application from cleanly disposing of its resources. Again this problem was not visible in TC8, if it did happen it did not interfere with the application in the way it does now.
To make things worse, the two memory profilers I am used to refuse to work while TestComplete is active, so I cannot gather concrete evidence to support my case. Is there any way to force the TestComplete garbage collector to flush all references through script? Something like a .DisposeAll() method somewhere?
'*******************************************************************************
' Test_6_1
' Description : Ajouter une nouvelle transaction, la grille doit
' se rafraîchir automatiquement
'*******************************************************************************
Sub Test_6_1
Set FBankConcil = OpenBankConcilForm
Set grdConcil = FBankConcil.VBObject("grdConcil")
'Calculer le nombre d'enregistrement dans la grille
intNbrTrx = grdConcil.RowCount
'Ajout d'une transaction de Dépôt.
Set FDeposit = OpenDepositForm
Set grdDeposit = FDeposit.VBObject("grdDeposit")
FDeposit.VBObject("cmdPmtMeth").Click
If Not SearchInQuickList(PMTMETH_CASH, "", True, False) Then
Log.Error "La méthode de paiement sélectionnée n'existe pas!"
Exit Sub
End If
grdDeposit.SetFocus
DynaGrid_SelectCellByName grdDeposit, "DepDet.RecFrom", grdDeposit.NewRowPosition, True : Sys.Keys "1 - Client Comptoir[Right][F2]1000[Tab]"
depositNumber = FDeposit.VBObject("txtDepNo").Text
FDeposit.VBObject("cmdOK").Click
FDeposit.VBObject("cmdCancel").Click
If intNbrTrx + 1 <> grdConcil.RowCount Then
Log.Error "La transaction n'a pas été ajoutée correctement ou la grille n'a tout simplement pas été rafraichit"
Exit Sub
End If
CloseBankConcilForm
DeleteDeposit depositNumber
End Sub