How to get current iteration number of QTP script?

QTP test can run several iterations.
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:

If we run our QTP test with above settings (global DataTable & 'Run' tab), the test will pass 3 iteration.
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:

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:


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: Dmitry Motevich's email

Thank you in advance, dear readers.

--
Dmitry Motevich

LoadRunner VIDEO tutorial - Parameters part2 ('Select next row' = 'Random')

I've prepared the second part of LoadRunner video tutorial on working with LoadRunner parameters.
Note: First part of LoadRunner parameters - video tutorial is available here.

The present LoadRunner video tutorial covers the following:
  • How to create new LoadRunner parameter
  • Settings on Parameter List dlg
    Option 'Select next row' = 'Random'
    Option 'Update value on' = 'Each iteration'
    Option 'Update value on' = 'Each occurrence'
    Option 'Update value on' = 'Once'
  • How to view an output value of parameter
LoadRunner parameters explained
part 2 of 3 (Select next row = Random)

How to record LoadRunner script on FireFox?

By default, LoadRunner records Web applications on Internet Explorer browser.
LoadRunner recording options look like on this image:


How to record LoadRunner script on FireFox?

Answer:
Use the following Recording options:

Use these settings with any LoadRunner Web protocol, such as:
  • Web (HTTP/HTML)
  • AJAX (Click and Script)
  • Web (Click and Script)
This way works correctly for all FireFox versions - 1.5, 2.0, 3.0.


Related articles:

10 steps to become QTP guru

Would you like to know how to become QTP guru?
The recipe is simple. You should learn the following:
  1. VBScript
    QTP uses VBScript language. That's why strong knowledge of VBScript is 'must have'.
    Sources:

  2. Software Testing Automation Frameworks
    To write good automated tests, you should know how to write them.
    There are different approaches and solution. There is not a silver bullet.
    Sources:

  3. HP QuickTest Professional Tutorial
    This QTP tutorial cames with QTP.
    It's quite clean and informative. Its main goal is to show and explain basic concepts of QuickTest Professional. It provides knowledge on:
    • creating a test
    • working with Object Repository (OR)
    • running and analyzing tests
    • verifying tests
    • parameterizing, etc
    Sources: '\help\QTTutorial.pdf' or '\help\Tutorial.chm' in QTP Install folder.

  4. HP QuickTest Professional User's Guide
    As previous tutorial, the present User's Guide come with QTP install too.
    This guide is intended for QuickTest Professional users at all levels. It gives a deeper knowledge on:
    • working with QTP Object Repositoies
    • designing tests
    • enhancing tests (checkpoints, parameterizing, etc)
    • maintaining anf debugging tests
    • advanced testing features, etc
    Sources: '\help\QTUsersGuide.pdf' or '\help\MainUsersGuide.chm' in QTP Install folder.

  5. COM/DCOM Technologies
    When working with QTP, you will be closely linked with such Microsoft's applications, as: Excel, Word, Outlook. So, I recommend to get familiar with COM, COM Technologies, and COM objects of:

  6. SQL
    SQL is so important in programming, that I strongly recommend to spend time to learn SQL:
    • concepts of RDBM
    • selecting/updating/deleting data
    • SQL queries optimizations
    • databases administration
    Sources:

  7. XML
    XML is an extremely popular and useful format. I'm sure that нou will have to deal with data, stored in XML-files.
    Sources:

  8. HTML, DOM
    Since QuickTest Professional works perfectly with web applications, you should be expert in related fields - HTML, HTTP, DHTML, DOM, etc. They will simplify your future QTP script and make them more reliable and maintenable.
    Sources:

  9. HP QTP Knowledge Base
    It contains a lot of practical articles about QuickTest Professional.
    You can find there QTP webinars, QTP FAQs, documentations, solutions of your problems or different ways how to improve your QTP automated tests.
    Sources:

  10. Useful sites
    Sure, it's impossible to know all information on QTP.
    That's why I recommend to use these two sites to search answers to your QTP questions:


Related articles:


Do you like this QTP Tutorial? Would you like to receive them in the future?
If yes, please subscribe to this blog RSS feed or by Email. (How to subscribe? Video guide)




Related video:
Becoming a Software Testing Expert - James Bach




Do you like this QTP tutorial?
Feel free to use/copy/publish all my materials on your site/blog!