Highlighted
Frequent Contributor.
Frequent Contributor.
1110 views

UFT script runs only 1 Iteration and fails to oepn the application in second iteration.

Hi , 

I am using UFT 12.53 and executing a script to test the standalone application on my machine, the script runs fine for 1 iteration but when the script tries to open the application for second iteration the application does not launch and the script fails at second iteration.

When i try opening the application manually it opens fine but fails with UFT code.

When i try and close UFT and try to run the script for second iteration by setting the current row of datatable to 2  the script runs fine.I also get UFT running low on space notification frequently.

Please find the machine details.

OD: Windows 10,64 bit machine

Can anyone please help me with this issue ?

 

 

 

0 Likes
2 Replies
Highlighted
Valued Contributor.
Valued Contributor.

Normally you'd run into this situation because of your script design.  If for instance you are using the settings in the Record and Run Settings dialog to open the application this could explain your situation as that setting will only open the application once at the beginning of the run, and not on each iteration.  So if you recorded this way and then as part of your recording you closed the application at the end, you would see the issue because the 2nd iteration wouldn't even attempt to reopen the application.

There are multiple solutions to this.  One would be to design your script using multiple actions, say a Login Action, a Main Action, and a Logout Action, and to put the parameters (and therefore the iterations) in the Main Actions' data sheet.  This way the test would only run a single iteration, so login and logout would only be needed once, and the Main Action itself would iterate a bunch of times.

A second solution, and more my preference is to not use the Record and Run settings to open the application, but to use the systemutil.run command.  If this command is at the beginning of your script it will open the application each iteration.  So again, assuming you are closing the application at the end of each iteration, this way it'd restart each time.

The one thing that gives me pause though is you saying when you manually open it, that it fails.  It'd really depend on what the failure is, but that shouldn't happen.  There is a rule that the application should be open after UFT, but in your case it sounds like that is being followed.  If the application is opened before UFT, occasionally UFT won't be able to hook into the application and will not see anything.

0 Likes
Highlighted
Frequent Contributor.
Frequent Contributor.

Hi James,

Thanks for the Response,

I am using SystemUtil.Run to open the application and also i have tried to divide the script into multiple actions and used function library for common functions.

I close the application after the actions are performed using .close method

Still the script works only for 1 iteration and i have to closed UFT and restart it to run the second iteration.

 

 

0 Likes
The opinions expressed above are the personal opinions of the authors, not of Micro Focus. By using this site, you accept the Terms of Use and Rules of Participation. Certain versions of content ("Material") accessible here may contain branding from Hewlett-Packard Company (now HP Inc.) and Hewlett Packard Enterprise Company. As of September 1, 2017, the Material is now offered by Micro Focus, a separately owned and operated company. Any reference to the HP and Hewlett Packard Enterprise/HPE marks is historical in nature, and the HP and Hewlett Packard Enterprise/HPE marks are the property of their respective owners.