Ganeshja
Ganeshja

Reputation: 2765

how to get current VAPI XP Test ID using VBScript?

I have a piece of code in VB Script to add test parameters

Dim supportParamTest
Set supportParamTest = TDConnection.TestFactory.Item(1404)
Set testParamsFactory = supportParamTest.TestParameterFactory
Set parameter = testParamsFactory.AddItem(Null)
parameter.Name   ="Name"
parameter.Description = "desc"
parameter.Post

in line no : 2 TDConnection.TestFactory.Item(1404) here "1404" is hard coded test id , i.e the above code will add test parameters to test id 1404 Now i need to get the TestID of the current Test to make it generic

Can any one help me out?

Upvotes: 0

Views: 2519

Answers (2)

Ganeshja
Ganeshja

Reputation: 2765

Dim TestName 
Dim supportTests 
Set supportTests = TDConnection.TestFactory 
Set Test = TestFactory.Fields 
TestName = ID 
TDOutput.Print(TestName)

Successfully retrieves the current Test ID. It works !

Upvotes: 0

Vernon Crabtree
Vernon Crabtree

Reputation: 19

This is an old post, but in case anyone needs to know: In a VAPI script, the global ID is available from the start. No need to 'retrieve' anything. So answer from Ganeshja works, but only because ID was already available. The global variable ThisTest is available. So for the above question, it would make more sense to use: Set testParamsFactory = ThisTest.TestParameterFactory

Upvotes: 1

Related Questions