Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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.

like image 940
Nick L Avatar asked Mar 19 '23 00:03

Nick L


1 Answers

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

like image 127
Nick L Avatar answered Mar 22 '23 23:03

Nick L