Vbscript 使用currentTstTest obj为VAPI-XP测试添加参数
我是VBScript新手,目前我已经创建了一个新的VAPI-XP测试>测试计划, 创建VAPI测试后,我使用测试参数选项卡将参数添加到测试中 现在,在测试脚本(VBSCRIPT)选项卡下,我需要获取添加的参数 有人能帮我吗!!请 VBSCRIPTVbscript 使用currentTstTest obj为VAPI-XP测试添加参数,vbscript,hp-quality-center,Vbscript,Hp Quality Center,我是VBScript新手,目前我已经创建了一个新的VAPI-XP测试>测试计划, 创建VAPI测试后,我使用测试参数选项卡将参数添加到测试中 现在,在测试脚本(VBSCRIPT)选项卡下,我需要获取添加的参数 有人能帮我吗!!请 VBSCRIPT Sub Test_Main(Debug, CurrentTestSet, CurrentTSTest, CurrentRun) On Error Resume Next TDOutput.Clear return = XTools.run("D:\AC
Sub Test_Main(Debug, CurrentTestSet, CurrentTSTest, CurrentRun)
On Error Resume Next
TDOutput.Clear
return = XTools.run("D:\ACoE RnD Team\Eclipse Workspace\SilkTest\InitScript.bat","Scenario1 TC1 Regression RunAllIterations 0 0 firefox 3.6 WINDOWS")
我需要把我的测试参数带到Xtools.run来代替Scenario1、TC1、回归
我无法使用params,因为它已被弃用,我不知道使用TestParameterFactory对象
//用于从测试脚本添加参数的示例vbscript,但它不起作用
Set testParamsFactory = supportParamTest.TestParameterFactory
Set parameter = testParamsFactory.AddItem(Null)
parameter.Name = "name"
parameter.Description = "desc"
parameter.Post
有人能建议我使用CurrentTSTest obj获取参数吗?您应该可以这样做:
Set aParam = CurrentTSTest
Set paramValueFct = aParam.ParameterValueFactory
Set lst = paramValueFct.NewList("")
For Each param In lst
With param
TDOutput.Print("Name: " & .Name & ", Value: " & .DefaultValue)
End With
Next
不过,您的里程数可能会因默认值的格式而有所不同。您应该可以这样做:
Set aParam = CurrentTSTest
Set paramValueFct = aParam.ParameterValueFactory
Set lst = paramValueFct.NewList("")
For Each param In lst
With param
TDOutput.Print("Name: " & .Name & ", Value: " & .DefaultValue)
End With
Next
您的里程数可能会因默认值的格式而异。成功地从测试参数选项卡中检索到了
默认值
参数
Set SetTestParameter = TestFactory.Item(intTestID)
Set TestParamsFactory = SetTestParameter.TestParameterFactory
Set IterateparameterValue = TestParamsFactory.NewList("")
for each IterateParam in gobjIterateparameterValue
ParamFieldDefaultValue = IterateParam.DefaultValue
TDOutput.Print (ParamFieldDefaultValue)
next
它起作用了!在不使用CurrentTSTest obj的情况下,仅通过传递当前测试ID(intTestID)来访问参数选项卡成功地从测试参数选项卡检索到
默认值
参数
Set SetTestParameter = TestFactory.Item(intTestID)
Set TestParamsFactory = SetTestParameter.TestParameterFactory
Set IterateparameterValue = TestParamsFactory.NewList("")
for each IterateParam in gobjIterateparameterValue
ParamFieldDefaultValue = IterateParam.DefaultValue
TDOutput.Print (ParamFieldDefaultValue)
next
它起作用了!不使用CurrentTSTest obj,只需通过当前测试ID(intTestID)访问参数选项卡那么您使用@candita的解决方案,然后将其作为您自己的解决方案写入,然后将您的答案作为接受的答案?那么您使用@candita的解决方案,然后将其作为您自己的解决方案写入,然后将您的答案作为接受的答案?