Monday, June 21, 2010

QTP: Using a parameter in the DataTable as a global incrementer

I needed to find a way to have a global incrementer to count all iterations that passed or failed during a QTP run.
This is one way of doing it using DataTable

Adding a new Sheet in The DataTable
DataTable.AddSheet("Temp")

Adding a Parameter to the Sheet ( Default value 0 )
DataTable.GetSheet("Temp").AddParameter "Counter","0"

Increment Value
DataTable.GetSheet("Temp").GetParameter("Counter").ValueByRow(1) = DataTable.GetSheet("Temp").GetParameter("Counter").ValueByRow(1) + 1

Updating a Custom TestSet Parameter
Set currentTSTest = QCUtil.CurrentTestSetTest
currentTSTest.Field("TC_USER_11") = DataTable.GetSheet("Temp").GetParameter("Counter").ValueByRow(1)
currentTSTest.Post

1 comment:

Unknown said...

Hi how do we add run time parameter values in qc in the "Actual Values" tab in Test Lab for each test step in a test case for a given Test Set using datatable.