退出“;如果;在“a”中;而";vbscriptqtp中的循环

退出“;如果;在“a”中;而";vbscriptqtp中的循环,vbscript,while-loop,qtp,Vbscript,While Loop,Qtp,我遇到了退出while循环的问题 我试过使用break,Exit do 自动测试用例的算法如下 while true do some tasks if total >200 then do some tasks and exit out of while loop if this condition reaches End if wend 如果唯一的退出点位于total>200 do do_some_tasks

我遇到了退出while循环的问题 我试过使用break,Exit do

自动测试用例的算法如下

while true
do some tasks
    if total >200 then 
       do some tasks 
       and 
       exit out of while loop if this condition reaches
    End if
wend

如果唯一的退出点位于
total>200

do
    do_some_tasks
    if total > 200 then
        do_total_related_tasks
    end if 
loop until total > 200
这可以简化为

do
    do_some_tasks
loop until total > 200
do_total_related_tasks
对于更通用的多个退出点,最快的选项是
exit do

do
    do_some_tasks
    if total > 200 then
        do_total_related_tasks
        exit do
    end if 
    other_tasks
loop while true
或者,对于更一般的解决方案,使用变量

keepTesting = true
do
    do_some_always_tasks
    ' start to test conditions
    if keepTesting then if total > 200 then 
        do_total_related_tasks
        keepTesting = false
    end if 
    if keepTesting then if other_exit_condition then
        .....
        keepTesting = false
    end if 
    .....
loop while keepTesting

或者根据实际问题的任何其他构造。

如果唯一的退出点位于
总计>200

do
    do_some_tasks
    if total > 200 then
        do_total_related_tasks
    end if 
loop until total > 200
这可以简化为

do
    do_some_tasks
loop until total > 200
do_total_related_tasks
对于更通用的多个退出点,最快的选项是
exit do

do
    do_some_tasks
    if total > 200 then
        do_total_related_tasks
        exit do
    end if 
    other_tasks
loop while true
或者,对于更一般的解决方案,使用变量

keepTesting = true
do
    do_some_always_tasks
    ' start to test conditions
    if keepTesting then if total > 200 then 
        do_total_related_tasks
        keepTesting = false
    end if 
    if keepTesting then if other_exit_condition then
        .....
        keepTesting = false
    end if 
    .....
loop while keepTesting

或者根据实际问题的任何其他构造。

如果唯一的退出点位于
总计>200

do
    do_some_tasks
    if total > 200 then
        do_total_related_tasks
    end if 
loop until total > 200
这可以简化为

do
    do_some_tasks
loop until total > 200
do_total_related_tasks
对于更通用的多个退出点,最快的选项是
exit do

do
    do_some_tasks
    if total > 200 then
        do_total_related_tasks
        exit do
    end if 
    other_tasks
loop while true
或者,对于更一般的解决方案,使用变量

keepTesting = true
do
    do_some_always_tasks
    ' start to test conditions
    if keepTesting then if total > 200 then 
        do_total_related_tasks
        keepTesting = false
    end if 
    if keepTesting then if other_exit_condition then
        .....
        keepTesting = false
    end if 
    .....
loop while keepTesting

或者根据实际问题的任何其他构造。

如果唯一的退出点位于
总计>200

do
    do_some_tasks
    if total > 200 then
        do_total_related_tasks
    end if 
loop until total > 200
这可以简化为

do
    do_some_tasks
loop until total > 200
do_total_related_tasks
对于更通用的多个退出点,最快的选项是
exit do

do
    do_some_tasks
    if total > 200 then
        do_total_related_tasks
        exit do
    end if 
    other_tasks
loop while true
或者,对于更一般的解决方案,使用变量

keepTesting = true
do
    do_some_always_tasks
    ' start to test conditions
    if keepTesting then if total > 200 then 
        do_total_related_tasks
        keepTesting = false
    end if 
    if keepTesting then if other_exit_condition then
        .....
        keepTesting = false
    end if 
    .....
loop while keepTesting
或者根据实际问题的不同而进行的其他构造