QTP/UFT support tip: How manage same iteration index from a called API test than the caller API test
If the purpose is that the called API test from Unified Functional Testing (UFT) runs the same datatable row index than the caller test(example:caller test is on its third iteration so called test will runs the third row of is own datatable) then there is a process that can be performed.
It would be necessary to handle it by variables and parameters with custom code.
How to do it:
1-From called test(secondary iteration in this sample) create a input parameter for Start(in the sample Param1)
In this sample Datatable has 2 columns
10-Doubleclick on the custom code activity to move to the custom code page and create a function called setcurrentRow and add the code as below
public void setCurrentRow(object sender, STActivityBaseEventArgs args)
//Set the variable MyRow with the index row passed from Param1 to RowNumer input parameter
int myRow = Int32.Parse(this.CodeActivity6.Input.RowNumber);
//With the index obtained we can get the information of the specific row column of the datatable and assign it into the output parameters of the custom code activity.
this.CodeActivity6.Output.FirstCol = this.GetDataSource("myDatatable").GetValue(myRow," FirstCol").ToString();
this.CodeActivity6.Output.SecondCol = this.GetDataSource("myDatatable").GetValue(myRow,"SecondCol").ToString();
Now this output parameters can be used on thesecondary test to datadrive the next activities instead of datadrive them using directly the datatable.