Why TestIteration?
A good use of “TestIteration” built in environment variable would be if you want to execute a specific section of Sceipt based on the number of Iteration. For example, if the test runs the first iteration we want to execute Function A and 2nd iteration Function B.
How to read the runtime Test Iteration?
TestIteration is a built-in environment variable in Quick Test Professional, so we can read it using the Environment keyword. The syntax is bellow:
tIteration = Environment(”TestIteration”)
Example of TestIteration use:
‘Using If-Else statment
tIteration = Environment(”TestIteration”)
If tIteration = 1 Then
Call FunctionA()
ElseIf tIteration = 4 Then
Call FunctionB()
End If
Note: Quick Test Pro (QTP) also have “ActionIteration” environment variable to read action iteration.
Comments