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
    Aug 2008
    Location
    Michigan
    Posts
    5
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Total Downloaded
    0

    Restarting script after error.

    Hi all,
    I have a script that I want to restart if an error/condition occurs. Ok so if I am running a script 10 times and say a duplicate piece of data gets entered after 2 successful iteration. I want to know if it possible to stop the script and advance to the next piece of data in the data table and restart the script. Has anyone done this and can it be done.

    By the way I'm working with QTP version 8.2

    Thanks
    Ross

  2. #2
    Senior Member
    Join Date
    Feb 2008
    Location
    Los Angeles, CA, USA
    Posts
    861
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Total Downloaded
    0

    Re: Restarting script after error.

    As I understand you requirement, you want to skip an iteration if certain condition is met. You don't need to stop and restart your script. There are different possibilities

    <ul type="square">[*] You can check for the condition as soon as you enter the next iteration (i.e. first step after For ... Next statement). If true Then : i=i+1
    [*] Check for the condition is somewhere in the middle of FOR structure, then create something like this:
    <font class="small">Code:</font><hr /><pre>
    For .... Next

    Do
    ...
    'some statements
    ...

    'if true then exit do loop (continue to next iteration)
    If True Then : Exit Do

    'if not true, continue executing rest of the statements

    Exit Do

    Loop

    Next
    </pre><hr />
    [/list]
    -Suchit

  3. #3
    Junior Member
    Join Date
    Aug 2008
    Location
    Michigan
    Posts
    5
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Total Downloaded
    0

    Re: Restarting script after error.

    Actually I want to end the current iteration and move on to the next. I'm using the "Data Table iteration" in the "Action call Properties" to set the number of iterations I want to run. Are you saying it's better to hard code a loop in the script than setting the number of iterations on the action?

    Thanks

  4. #4
    Senior Member
    Join Date
    Feb 2008
    Location
    Los Angeles, CA, USA
    Posts
    861
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Total Downloaded
    0

    Re: Restarting script after error.

    I am providing you a couple of options. Its not hard coding; its still a dynamic code. Better or not, on you to decide.

    You can use Do .... Loop and If in combination to skip the rest of the part of the script and that will effectively take you to the next iteration.
    -Suchit

 

 

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 11.54%
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 08:34 AM.

Copyright BetaSoft Inc.