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.
Related articles:
- How to record QTP script - VIDEO tutorial
- How to get text of status bar from QTP?
- QTP VIDEO - How to capture dynamic text
- QTP Descriptive programming - processing images
- QTP - How to capture tool tip?
- How to minimize/maximize QTP window before the QTP script execution
- All QTP visual tutorials
Have you got interested materials or your own thoughts on QTP (QuickTest Professional)?
Let's share them and help each other to improve our skills and knowledge!
You can send them to my email:
Thank you in advance, dear readers.
--
Dmitry Motevich
2 comments:
Hi Dmitry,
I'm having a problem to get the status(pass or fail) during runtime for every iteration ran, and must get the results stored to an excel sheet if possible.
Regards
Colin
@Italiano,
Please send your QTP questions to QTP Google Group
Post a Comment