循环中断后,怎么查看已运行的次数
如题。比如以下一段代码,for(i=1;i<=140;i++)
{
# RTU3
set_window ("RTU3", 2);
obj_mouse_click ("#32770", 615, 44, LEFT);
button_press ("Online");
button_press ("Update");
# Update Target
set_window ("Update Target", 1);
button_press ("...");
# 打开
set_window ("打开", 1);
list_activate_item ("查找范围(I):_1", "mox902-0002-002 V2.06.19.000 .mtg");
...
}
这段代码中我设定循环是140次,但是可能运行到x次时,我的软件出现异常了,当然,这个时候winruuer是不会在继续执行了,此时我怎么查看这段代码已经执行了多少次了
或者无法查看的话,还没有什么更好的循环方式或者代码!
谢谢指导! 最原始方法看result, 这段代码执行下来,只有一个结果,即140次运行完后,才出一个结果。怎么修改,可以运行一次就出一个结果呢? tl_step 用report_msg(i);把当前的i值输出到report中即可 太感谢了。test1978的方法我已经试过了,不错。dabie的没有明白是怎么回事,因为我是菜鸟,这个东西基本都不会的。 tl_step ( step_name, status, description );
step_name the name of the test step.
status sets whether the step passed or failed. Set to 0 for pass, or any other integer for failure.
description a short explanation of the step.
The tl_step function divides test scripts into sections and determines whether each section passes or fails. When the test run is completed, you view the test results in the Test Results window. The report displays a result (pass/fail) for each step you defined.
When WinRunner is connected to a Quality Center project, the message is inserted in the Quality Center "step" table as well.
When using Quality Center to plan and design tests, use tl_step to create test steps in your automated test scripts. For more information, refer to the "Creating Automated Tests" chapter in your Quality Center User's Guide.
# Get the fries quantity.
static_get_text("Fries Quantity",text);
if (text>0)
tl_step("Verify Text", 0, "The Fries quantity field is OK.");
else
tl_step("Verify Text", 1, "The Fries quantity field is not reset to zero."); #Get the fries quantity.
static_get_text("Fries Quantity",text);
if (text>0)
tl_step("Verify Text", 0, "The Fries quantity field is OK.");
else
tl_step("Verify Text", 1, "The Fries quantity field is not reset to zero.");
问一下,
1.t1_step 可以单独使用吗?
2.查了下static_get_text("Fries Quantity",text);text的返回值,要么是0,要么小于0,如果"Fries Quantity"处于disable状态,返回值是多少?
这样是不是程序就中断,不执行了?
3.如果程序中断了,怎么样让他继续执行?比如程序中断后,可以收到选择"继续"让程序继续运行或者选择“stop”来停止这段代码的运行
不知道我问的请不清楚?自己还不是很懂。 如果只是想看这个执行了几次,就
if (text>0) tl_step("Verify Text", 0, "The run number is:"&i);
这样可以了,,其中(text>0)为你程序中断的标志,i为你循环的次数,这样应该能够满足你的需求了
页:
[1]