0

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?

Abhishek Asthana
  • 1,857
  • 1
  • 31
  • 51
Ganeshja
  • 2,675
  • 12
  • 36
  • 57

2 Answers2

3

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.

candita
  • 101
  • 1
  • 3
0

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)

marc_s
  • 732,580
  • 175
  • 1,330
  • 1,459
Ganeshja
  • 2,675
  • 12
  • 36
  • 57
  • So you used @candita's solution but then wrote it over as your own and then gave your answer as the accepted answer? – Harrison Nov 20 '13 at 04:24