SPONSORS:






User Tag List

Thanks Thanks:  0
Likes Likes:  0
Dislikes Dislikes:  0
Results 1 to 4 of 4
  1. #1
    Junior Member
    Join Date
    Dec 2007
    Posts
    8
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Total Downloaded
    0

    Manipulating datatable iterations

    Noob here. I did a search and couldn't find any solution to this:

    I'm using VBscript functions instead of actions. In my test, i use 3 datatables:

    Global - To determine what test scripts to run for different products (Sheet1, Sheet2, Sheet3....etc.)

    Sheet1 - Actual test scripts to run for product A (Step1, Step2, Step3...etc.)

    Sheet2 - Actual test scripts to run for product B (Step1, Step2, Step3...etc.)

    Scenario:

    When my test begins i would like to read the Global datatable and locate the Sheet to run (eg. Sheet1), then read the appropriate Sheet and iterate through that Sheet and run the steps. When it is done with the first Sheet, it moves on to the next Sheet on the Global datatable (eg. Sheet2) and then does the same thing.

    Problems:

    1) I can't figure out a way to loop through the other sheets without writing a loop myself. QTP's loop functionality only seems to serve the Global datatable.

    2) Test Results - The default test results feature in QTP only reports the pass/fail status for each iteration in the Global datatable. I would like to have it report for the other Sheets as well.

    3) Error Handling - I have the test settings set to proceed to next iteration when an error occurs. During run time, the test moves to the next iteration on the Global datatable instead of the next iteration on the action sheet as intended.

    Maybe i'm just missing something here. But i have searched the forum extensively and also the user guide with no success. Any help would be greatly appreciated.

  2. #2
    Junior Member
    Join Date
    Dec 2007
    Posts
    8
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Total Downloaded
    0

    Re: Manipulating datatable iterations

    Help, anyone?

  3. #3
    Junior Member
    Join Date
    Jun 2006
    Posts
    27
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Total Downloaded
    0

    Re: Manipulating datatable iterations

    try right clicking on the action in the keyword view and selecting action call properties- that should display a datatable iterations dialog. select run on all rows or a defined range. Conceptually, the way to iterate through all your sheets is to associate each sheet with a separate action, QTP does this by default as it adds action tabs to the datatable.

  4. #4
    Advanced Member
    Join Date
    Mar 2007
    Location
    Salt Lake City, UT, USA
    Posts
    606
    Post Thanks / Like
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)
    Total Downloaded
    0

    Re: Manipulating datatable iterations

    Here's what I do.

    My Main action is a simple script that has a datasheet called "Main". This datasheet has only two columns. The first column contains "yes" or "no", the second column is the name of all the other actions in the script.

    I get the rowcount of the "Main" datasheet, then loop for i = 1 to that rowcount.

    Inside the loop I use SetCurrentRow to set the row of "Main" = i, then I check column 1 to see if I should run that action or not. If it is "yes" then I run the action named in in column 2. Note that I always run just one iteration of these other actions.

    Each action begins by getting its own row count and then using a for..next loop with a SetCurrentRow statement to loop through its own datasheet.

    Note that you may need to use the GetSheet method in many of your DataTable statements. For example: DataTable.GetSheet("sheetname").SetCurrentRow (i).

    To answer your three Problems:
    1. Yes, write your own loop. If you let QTP manage your iterations, you must do so at your own risk.

    2. I am not sure why this is happening for you, unless it's related to problem 1 - fix problem 1 and see if you have the same concern with problem 2.

    3. You can handle much of this within your loop. Use GetROProperties and If..Then statements to control your error handling. Do not use the test settings to go to the next iteration since you are running these actions as one iteration only.

    This framework works really well for me. I can use the first column of the "Main" datasheet to turn the other actions off and on very quickly. I can use similar funcitonality in the datatables of each of my reusable actions to turn individual rows off and on very quickly (I do this to exempt certain rows for various reasons, such as when I just want to debug rows 25-30, I can turn off the other rows in just a few seconds -- or I can edit my for..next loop). It gives you a great deal of very flexible control over all your actions and their iterations.
    "The last 10% of any software project will take 90% of the budgeted time. The first 90% will take the other 90%"

 

 

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Search Engine Optimisation provided by DragonByte SEO v2.0.36 (Pro) - vBulletin Mods & Addons Copyright © 2016 DragonByte Technologies Ltd.
Resources saved on this page: MySQL 10.71%
vBulletin Optimisation provided by vB Optimise v2.6.4 (Pro) - vBulletin Mods & Addons Copyright © 2016 DragonByte Technologies Ltd.
User Alert System provided by Advanced User Tagging v3.2.8 (Pro) - vBulletin Mods & Addons Copyright © 2016 DragonByte Technologies Ltd.
vBNominate (Lite) - vBulletin Mods & Addons Copyright © 2016 DragonByte Technologies Ltd.
Feedback Buttons provided by Advanced Post Thanks / Like (Pro) - vBulletin Mods & Addons Copyright © 2016 DragonByte Technologies Ltd.
Username Changing provided by Username Change (Free) - vBulletin Mods & Addons Copyright © 2016 DragonByte Technologies Ltd.
BetaSoft Inc.
Digital Point modules: Sphinx-based search
All times are GMT -8. The time now is 06:22 PM.

Copyright BetaSoft Inc.