By default, when you run a test with global QTP Data Table parameters, QuickTest runs the test for each row in the Data Table, using the parameters you specified.
For example, the following global QTP Data Table contains 3 rows:
The iteration number of QTP test can be specified in 'File/Settings.../Test Settings dialog', 'Run' tab:
So, the question is How to determine the current iteration number withing QTP script?
Answer: We can use the value of "TestIteration" environment variable - Environment("TestIteration").
This is a sample QTP script I use to demonstrate Environment("TestIteration"):
str = "Current QTP iteration: " & Environment("TestIteration") & vbNewLine & _
"Param1: " & DataTable("Param1", dtGlobalSheet) & vbNewLine & _
"Param2: " & DataTable("Param2", dtGlobalSheet)
MsgBox str
And the result of above QTP script is:"Param1: " & DataTable("Param1", dtGlobalSheet) & vbNewLine & _
"Param2: " & DataTable("Param2", dtGlobalSheet)
MsgBox str
As you can see, QuickTest Professional script works correctly.
You can use this approach to determine the current iteration number of running QTP script.
SOURCE
0 comments:
Post a Comment