4

如何从启动 QTP 测试的 .vbs 文件中获取测试参数?我可以在没有任何输入参数的情况下从 .vbs 文件运行我的测试,但我似乎找不到将我的参数从文件中获取到测试的方法。

这是我到目前为止所拥有的:

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

我觉得需要有某种test.ParameterDefinitions.SetParameters(),但这就是我在网上找到的全部。

4

1 回答 1

7

test.Run qtpResultsLocation实际上并没有传递参数。我需要写test.Run qtpResultsLocation, True, params

于 2014-07-17T16:21:46.837 回答