Results 1 to 8 of 8

Thread: Code to stop an iteration

  1. #1
    Expert Member
    Join Date
    Oct 2006
    Answers
    209

    Code to stop an iteration

    Hi tell me the code to stop an iteration in between the run in QTP?

    NOTE : [This question was asked by rameshkumars]


  2. #2
    Expert Member
    Join Date
    Nov 2006
    Answers
    518
    Change the value of the loop counter when the condition satifies to stop an iteration.

    Eg:

    for i=0 to 10 step 1
    if (condition) then
    i=(10 to exit the for loop/ i+1 to stop current iteration continue)
    end if
    ----
    ----
    --- other loop statements....
    next


    OR
    ExitTest as far as I know will exit the test.

    But, what we are talking about here is to exit the iteration and not the whole test.


    Last edited by jainbrijesh; 05-22-2007 at 08:47 AM.
    Lack of WILL POWER has caused more failure than
    lack of INTELLIGENCE or ABILITY.

    -sutnarcha-

  3. #3
    Junior Member
    Join Date
    Jan 2007
    Answers
    10

    Re: Code to stop an iteration

    you may just use "exitglobaliteration" once a condition is met.


  4. #4
    Expert Member
    Join Date
    Apr 2007
    Answers
    147

    Re: Code to stop an iteration

    Use exitIteration where ever the conditionis met


  5. #5
    Junior Member
    Join Date
    Feb 2007
    Answers
    17

    Re: Code to stop an iteration

    please give the example how to use?


  6. #6
    Junior Member
    Join Date
    Feb 2007
    Answers
    6
    ExitTest is enough

    OR

    Int_value = 20
    If (Int_value < 0)
    print "Positive number" & Int_value
    Else
    print "Negative number" & Int_value
    ExitTest
    EndIf
    print "Exittest is not executed"

    Last edited by jainbrijesh; 05-22-2007 at 09:19 AM.

  7. #7

    Re: Code to stop an iteration

    use ExitActionIteration("return value")


  8. #8
    Contributing Member
    Join Date
    Feb 2006
    Answers
    41

    Re: Code to stop an iteration

    Yes by making use of ExitActionIteration("return value") which has the return value generated in the decission making conditional loop. We can exit the iteration.

    If then
    ExitActionIteration("return value")
    Endif

    Arun*


Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
About us
Applying for a job can be a stressful and frustrating experience, especially for someone who has never done it before. Considering that you are competing for the position with a at least a dozen other applicants, it is imperative that you thoroughly prepare for the job interview, in order to stand a good chance of getting hired. That's where GeekInterview can help.
Interact