01-13-2009, 03:46 PM
The name of the Output parameter is correctly defined “log_run”. It's defined in QTP "Test Settings" and in "Action Properties". From VBS script side I wrote the following lines (the complete code is in attach):
qtApp.Open path_test & tc, True, False ' Open a test in a read-only mode
Set qtTest = qtApp.Test
'++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Set coll = qtTest.ParameterDefinitions ' Retrieve the parameters collection defined for the test.
Set params = coll.GetParameters() ' Retrieve the Parameters collection defined for the test.
'++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Set p1 = params.Item("path_test") ' Retrieve a specific parameter.
Set p2 = params.Item("log_run") ' Retrieve a specific parameter.
p1.Value = Left(path_test, 1) & ":\IT_Automation"
qtApp.Test.Run qtResultsOpt, True, params ' Run the test
'++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
out1 = p2.Value
MsgBox out1
Set params2 = coll.GetParameters()
out1 = params2.Item("log_run").Value
MsgBox out1
out1 = params2.Item(1).Value
MsgBox out1
From QTP test (Expert View) side, I used the following statements:
path1 = Parameter("path_test") ' To get the value of the input parameter loaded in VBS script.
Parameter("log_run") = log1 ' To transfer to the VBS script, via QTP Output parameter "log_run", one test value already occourred.
But, in QTP test (Action1) the value of path1 is an empty string and in VBS script all the values of the string "out1" are also empty strings.
Is it possible to exchange data values between VBS script and QTP?
qtp_run2.zip (Size: 1,022 bytes / Downloads: 63)
qtApp.Open path_test & tc, True, False ' Open a test in a read-only mode
Set qtTest = qtApp.Test
'++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Set coll = qtTest.ParameterDefinitions ' Retrieve the parameters collection defined for the test.
Set params = coll.GetParameters() ' Retrieve the Parameters collection defined for the test.
'++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Set p1 = params.Item("path_test") ' Retrieve a specific parameter.
Set p2 = params.Item("log_run") ' Retrieve a specific parameter.
p1.Value = Left(path_test, 1) & ":\IT_Automation"
qtApp.Test.Run qtResultsOpt, True, params ' Run the test
'++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
out1 = p2.Value
MsgBox out1
Set params2 = coll.GetParameters()
out1 = params2.Item("log_run").Value
MsgBox out1
out1 = params2.Item(1).Value
MsgBox out1
From QTP test (Expert View) side, I used the following statements:
path1 = Parameter("path_test") ' To get the value of the input parameter loaded in VBS script.
Parameter("log_run") = log1 ' To transfer to the VBS script, via QTP Output parameter "log_run", one test value already occourred.
But, in QTP test (Action1) the value of path1 is an empty string and in VBS script all the values of the string "out1" are also empty strings.
Is it possible to exchange data values between VBS script and QTP?
qtp_run2.zip (Size: 1,022 bytes / Downloads: 63)