51Testing软件测试论坛

 找回密码
 (注-册)加入51Testing

QQ登录

只需一步,快速开始

微信登录,快人一步

查看: 3480|回复: 8
打印 上一主题 下一主题

循环中断后,怎么查看已运行的次数

[复制链接]

该用户从未签到

跳转到指定楼层
1#
发表于 2009-5-18 15:23:27 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
如题。比如以下一段代码,
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是不会在继续执行了,此时我怎么查看这段代码已经执行了多少次了
或者无法查看的话,还没有什么更好的循环方式或者代码!
谢谢指导!
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏
回复

使用道具 举报

该用户从未签到

2#
发表于 2009-5-18 16:15:10 | 只看该作者
最原始方法看result,
回复 支持 反对

使用道具 举报

该用户从未签到

3#
 楼主| 发表于 2009-5-20 10:55:54 | 只看该作者
这段代码执行下来,只有一个结果,即140次运行完后,才出一个结果。怎么修改,可以运行一次就出一个结果呢?
回复 支持 反对

使用道具 举报

该用户从未签到

4#
发表于 2009-5-20 13:09:42 | 只看该作者
tl_step
回复 支持 反对

使用道具 举报

该用户从未签到

5#
发表于 2009-5-20 13:33:27 | 只看该作者
用report_msg(i);把当前的i值输出到report中即可
回复 支持 反对

使用道具 举报

该用户从未签到

6#
 楼主| 发表于 2009-5-20 15:45:09 | 只看该作者
太感谢了。test1978的方法我已经试过了,不错。dabie的没有明白是怎么回事,因为我是菜鸟,这个东西基本都不会的。
回复 支持 反对

使用道具 举报

该用户从未签到

7#
发表于 2009-5-21 16:02:35 | 只看该作者
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.");
回复 支持 反对

使用道具 举报

该用户从未签到

8#
 楼主| 发表于 2009-5-31 12:43:51 | 只看该作者
#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”来停止这段代码的运行
不知道我问的请不清楚?自己还不是很懂。
回复 支持 反对

使用道具 举报

该用户从未签到

9#
发表于 2009-6-1 15:54:06 | 只看该作者
如果只是想看这个执行了几次,就
if (text>0) tl_step("Verify Text", 0, "The run number is:"&i);
这样可以了,,其中(text>0)为你程序中断的标志,i为你循环的次数,这样应该能够满足你的需求了
回复 支持 反对

使用道具 举报

本版积分规则

关闭

站长推荐上一条 /1 下一条

小黑屋|手机版|Archiver|51Testing软件测试网 ( 沪ICP备05003035号 关于我们

GMT+8, 2024-5-25 12:31 , Processed in 0.071858 second(s), 27 queries .

Powered by Discuz! X3.2

© 2001-2024 Comsenz Inc.

快速回复 返回顶部 返回列表