vbscriptqtphp-uft

Passing test parameters from .vbs to QTP test


How can I get test parameters from a .vbs file that kicks off my test in QTP? I am able to run my test from the .vbs file without any input parameters just fine, but I can't seem to find a way to get my parameters from the file to the test.

Here is what I have so far:

Set qtp = CreateObject("QuickTest.Application")

'Launch QTP
qtp.Launch

'Set QTP visible
qtp.Visible = True

'Run Mode - Fast
qtp.Options.Run.RunMode = "Fast"

'View Results - True
qtp.Options.Run.ViewResults = True

'Open the test
qtp.open "C:\MY\TEST", True

Set test = qtp.Test

Set params = test.ParameterDefinitions.GetParameters()

parameter1 = "par1"
parameter2 = "par2"

params.Item(par1).Value = "This is my first parameter"
params.Item(par2).Value = "This is my second parameter"

Set qtpResultsLocation = CreateObject("QuickTest.RunResultsOptions")

qtpResultsLocation.ResultsLocation = "C:\SOME\RESULTS\FOLDER"
test.Run qtpResultsLocation

test.Close

Msgbox("Closed test.. closing application")
qtp.quit

I feel like there needs to be some sort of test.ParameterDefinitions.SetParameters(), but this is all that I found online.


Solution

  • test.Run qtpResultsLocation was not actually passing the parameters in. I needed to write test.Run qtpResultsLocation, True, params