Question

I am new to VBScript, currently i have created a new VAPI-XP Test > Test Plan , After creating the VAPI test , i have added parameters to my test using test parameters tab Now under Test script (VBSCRIPT) tab i need to get the added parameter

Can any one help me out !! Pls

VBSCRIPT

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") 

I need to bring my test parameters over to Xtools.run in place of Scenario1 , TC1, Regression...

I am unable to use params since its has been deprecated and i ve no idea of using TestParameterFactory object

//Sample vbscript for adding adding parameter from test script but it doesn't work

Set testParamsFactory = supportParamTest.TestParameterFactory
Set parameter = testParamsFactory.AddItem(Null)
parameter.Name = "name"
parameter.Description = "desc"
parameter.Post

can any one suggest me to get the parameters using CurrentTSTest obj?

Was it helpful?

Solution 2

Successfully retrieved the Default_Value param from test parameters tab

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

It works! Without using CurrentTSTest obj, accessing the parameter tab by just passing the current Test ID (intTestID)

OTHER TIPS

You should be able to do it like this:

 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

Your mileage may vary with the format of that DefaultValue though.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top