|
回复 1# 的帖子
1. File-Settings-Parameters里设置的Input和Output参数当然和TEST之间的调用有关系
2.不只是Test之间调用,你也可以理解成任何其他程序调用test,比如为test的输入构造参数,得到test的输出参数进行其他处理等等。
3.所谓输出输入参数,都是在运行时用的,这就归结到一个问题,如何运行时调用test?从我目前理解中,只有在QTP automation中会用到test的调用。这就跟excel等的automation一样,在其他程序中用到QTP的test.就如用到excel的workbook一样。其实你不用查别的资料,QTP本身的帮助就有这方面的信息。以下是帮助中抄的一个例子,应该可以帮助你理解这个问题
'************************************************************************************************************************
'Description:
'
'This example opens a test with predefined parameters,
' gets a collection of parameter definitions, Loops on it and display each parameter details,
' gets a collection of run-time parameters, change the value of one of them, run the test with parameters,
' after the test run - display the value of one of the out parameters.
'
'Assumptions:
' the test D:\Tests\Mytest contain in parameter called "InParam1" and out parameter called "OutParam1"
'************************************************************************************************************************
Dim qtApp 'As QuickTest.Application ' Declare the Application object variable
Dim pDefColl 'As QuickTest.ParameterDefinitions ' Declare a Parameter Definitions collection
Dim pDef ' As QuickTest.ParameterDefinition ' Declare a ParameterDefinition object
Dim rtParams 'As QuickTest.Parameters ' Declare a Parameters collection
Dim rtParam ' As QuickTest.Parameter ' Declare a Parameter object
'Dim cnt, Indx As Integer
Set qtApp = CreateObject("QuickTest.Application") ' Create the Application object
qtApp.Launch ' Start QuickTest
qtApp.Visible = True ' Make the QuickTest application visible
qtApp.Open "D:\Tests\MyTest"
' Retrieve the parameters collection defined for the test.
Set pDefColl = qtApp.Test.ParameterDefinitions
cnt = pDefColl.Count
Indx = 1
' Display the names and values of each of the parameters in the collection.
While Indx <= cnt
Set pDef = pDefColl.Item(Indx)
MsgBox "Param name: " & pDef.Name & "; Type: " & pDef.Type & "; InOut: " & pDef.InOut & "; Description: " _
& pDef.Description & "Default value: " & pDef.DefaultValue
Indx = Indx + 1
Wend
Set rtParams = pDefColl.GetParameters() ' Retrieve the Parameters collection defined for the test.
Set rtParam = rtParams.Item("InParam1") ' Retrieve a specific parameter.
rtParam.Value = "Hello" ' Change the parameter value.
qtApp.Test.Run , True, rtParams ' Run the test with changed parameters.
MsgBox rtParams.Item("OutParam1").Value ' Display the value of an output parameter after the test runs. |
|