I'm facing a problem when I try to execute a UFT script using a VBScript file to call it. The code inside the .vbs file is below:

dim uft
Set uft = CreateObject("QuickTest.Application") 
uft.Visible = False
uft.Open "R:\data\HPCJobsSpool\submit_2017.06_CAEDev\Gompute\BenchApp\uft_script"
uft.Test.Run Nothing, True, False
Set uft = Nothing
MsgBox "Test done"

Inside the UFT script I have 7 actions. When I double click the .vbs file the first action execute without problems, but when arrives in the second action start my problem: in all my actions (except the first one) has a code to create a .txt file. When the script create the first one (in the second action) it just stop to run all the rest of the second action and jump to third action to create the second .txt file, doing this for the rest of the actions.

I don't know how this .vbs script are really doing and why it do not following the order of the script, because when I run inside UFT all works perfectly. Can anyone know what is the cause of this problem?

Thanks and regards.

2 Answers 2


There are sometimes lots of unexpected in behaviour of UFT, so I recommend to do some experiments:

1) Test opening

uft.Open "R:\data\...\uft_script"          'replace with
uft.Open "R:\data\...\uft_script", False   'this will open the test in read-only mode

Also you can try True version of the parameter to be sure the problem is not there.

2) Visibility of UFT

uft.Visible = True    'make the UFT application visible

3) Running test

uft.Test.Run Nothing, True, False      'replace with
uft.Test.Run Nothing, True             'have never seen third param in run command

Or try to specify results directory

Set uftResults = CreateObject("QuickTest.RunResultsOptions")
uftResults.ResultsLocation = "R:\data\...\uft_script"
uft.Test.Run uftResults, True

The second parameter of Run command True/False is for waiting until end of the test run (or not waiting). Just for information, you can also change it to False but it is not likely to help in your case.

It's also useful to know the directory where text-files are created (to give more specific answer)


Since the test starts I would say the problem is not in the script but the test.

The issue with running tests from vbs in general is that any run errors are by default handled by ignoring them and continuing the test. So my guess would be that you experience a run error that is ignored and that's why a portion of the test code is skipped to some other part.

As to the error itself it could be somehow connected to the environment or some UFT configuration that is not used when running from the script.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.