Highlighted
Absent Member.
Absent Member.
436 views

Re: Immediacy of Do Until - not until the end of the loop?

By the way, I'm using 3 level nested loop to emulate the actions.

DO A = System Condition

     If this many errors so far, then Exit Run

Do Until (B) = This test iteration continues until all off the specified data sheet is done (or exited)

Do Until (C) = Run this data sheet until x case is complete and I just need to go to the next line.

   Select Case <action>

       Case <action value>

          During this case a condition may occur so I want to go to the test iteration (Loop B) or datasheet row (Loop C) without executing things outside the End Select.

         And depending on the case, I probably want to go run my rule checks.

        After those rule checks, all will either continue as normal, or require me to exit the datasheet and go back to the test iteration.

 

In other words, I'm trying to set my "Do Until" variable dependent on the loop level I want to return to.

   i.e. next iteration (Loop B) or next row (Loop C)

      goToLoopB - initialized as 0. Changed to 1 when needed

     LoopC - initalized as 1. (This can be an Exit Do, I know., but I end up with so many Exit Dos, that maintainability by the next author will be insanity.)

 

 

0 Likes
2 Replies
Highlighted
Absent Member.. Absent Member..
Absent Member..

Re: Immediacy of Do Until - not until the end of the loop?

First, what does this have to do with ALM/Quality Center, which is the topic of this forum? Is this maybe about a UFT/QTP test script - which would be more appropriately posted in the forum for that product?

http://community.hpe.com/t5/Unified-Functional-Testing/bd-p/sws-Fun_TEST_SF#.VqU5BlIbuOQ

Second, Do-Until loops will not exit the moment the condition becomes true. The code is linear, not event driven. The condition will not be evaluated until the line of code that does that evaluation is executed, linearly, as the last line in the loop.

If you want to evaluate your condition at the beginning of the loop instead of the end, use a While structure.

In any looping structure (Do, While, For, etc), if you want to exit a loop from within the middle of the loop, then you have to add code to check your condition variable in the middle of the loop, and then use an Exit command to exit the loop prematurely.

[If this post solves or helps solve your issue, mark the thread as solved and give KUDOS to the author for their assistance.]

(Opinions expressed in my postings are mine alone, and do not reflect the opinions of my employer.No warranties express or implied for any solution/suggestion posted.)
0 Likes
Highlighted
Absent Member.
Absent Member.

Re: Immediacy of Do Until - not until the end of the loop?

I see what you mean about the where to post.  Sorry about that!

It's an existing QTP script with actions that the customer wanted to modify, and rather than running macros in Word for every test report, I figured I could to it in ExpertView...  That's why I thought it was QTP related.

Sorry, but thank you for the answer!!

--Jan

0 Likes
The opinions expressed above are the personal opinions of the authors, not of Micro Focus. By using this site, you accept the Terms of Use and Rules of Participation. Certain versions of content ("Material") accessible here may contain branding from Hewlett-Packard Company (now HP Inc.) and Hewlett Packard Enterprise Company. As of September 1, 2017, the Material is now offered by Micro Focus, a separately owned and operated company. Any reference to the HP and Hewlett Packard Enterprise/HPE marks is historical in nature, and the HP and Hewlett Packard Enterprise/HPE marks are the property of their respective owners.