google搜索 站内搜索                 软件测试门户 | 软件测试培训 | 文章资料精选 | 软件测试论坛 | 测试解决方案 | 软件测试博客 | 测试招聘求职 
打印

请问在GUI中如何计时?一直没找到直接计时的命令,谢谢先!

请问在GUI中如何计时?一直没找到直接计时的命令,谢谢先!


TOP

上面不是有两个小时钟的么?starttimer("001")

TOP

这个命令不能直接输出啊,只能在日志里看,还有别的命令吗,谢谢


1

TOP

如果要求精度不是很高的话,你可以用以下方式输出到Console中:
:d
Sub Main

Dim Start_time
Dim End_time
Dim Total_time

Start_time = time

'执行的语句

End_time =time
Total_time = End_time - Start_time

SQAConsoleWrite("脚本运行用时共:"&Total_time)

End Sub
TESTer

TOP

可惜,只能精确到秒。哪位还有别的好办法?
TESTer

TOP

那就只能调用API函数拉。Robot可以调用系统函数
Type SYSTEMTIME
    wYear As Integer
    wMonth As Integer
    wDayOfWeek As Integer
    wDay As Integer
    wHour As Integer
    wMinute As Integer
    wSecond As Integer
    wMilliseconds As Integer
End Type

Declare Sub GetLocalTime Lib "kernel32" (lpSystemTime As SYSTEMTIME)
Declare function GetDay() as string
'系统的日期信息,精确到毫秒
function GetDay() as string

dim systime as systemtime
GetLocalTime systime
GetDay=cstr(systime.wYear) + "-" + cstr(systime.wMonth) + "-" + cstr(systime.wDay)+" "+cstr(systime.wHour)+":"+cstr(systime.wMinute)+":"+cstr(systime.wSecond)+":"+cstr(systime.wMilliseconds)
end function

TOP

 
当前时区 GMT+8, 现在时间是 2008-12-5 12:58Copyright(C)上海博为峰软件技术有限公司 2001-2007 电话:021-64471599-8017
当您在访问网站、论坛及博客过程中遇到问题时可发送email:webmaster@51testing.com或发送论坛短信至管理员风在吹