API test that calls GUI test hangs iterations
Category:
Question ID: 108968
1
0

My API test calls a GUI test. After running the GUI test, it won’t continue running iterations. The first iteration runs without a problem, but subsequent iterations hang and never complete. It happens only with one specific GUI script (See code below).

CustomerNumber = 649877
FilePath = "C:\\TestFiles\\CustomerList.txt"
Set fso = CreateObject("Scripting.FileSystemObject")
Set MyFile = fso.OpenTextFile(FilePath,1, True)
MyText = Split(MyFile.ReadAll,";") ‘Splits file into arrays

UpperBound = ubound(MyText)
For CustNo = 0 to UpperBound
If InStr(MyText(CustNo), CustomerNumber) > 0 Then
CustomerNumberFound = True
End If
Next

Marked as spam
Posted by (Questions: 387, Answers: 66)
Asked on April 26, 2019 4:27 pm
44 views
Answers (1)
0
Private answer

Any time you access the file system, you should close the connections, otherwise it could cause problems with UFT releasing the file. Add this code ad the end of your script and see if it works:

MyFile.Close
Set MyFile = Nothing
Set fso = Nothing

Marked as spam
Posted by (Questions: 17, Answers: 807)
Answered on April 26, 2019 4:27 pm
0
That worked for us. Thanks for the tip!
( at April 26, 2019 4:28 pm)
EyeOnTesting

Welcome back to "EyeOnTesting" brought to you by Orasi Software, Inc.

X
Scroll to Top