我的csdn博客地址: http://blog.csdn.net/blizzardlyk

QTP中判断Action运行是否超时

上一篇 / 下一篇  2010-08-25 10:39:53 / 个人分类:QTP

1 需要在环境变量中自定义一个最大超时时间

Environment("MAX_ACTION_TIMEOUT")

 

2 判断是否超时的方法:

Dim INT_ACTION_STARTTIME_MSEC 'global variable
INT_ACTION_STARTTIME_MSEC = Timer 'start time


Public Function CheckIfActionReachedTimeout()
 Dim intElapsedTimeMsec
    intElapsedTimeMsec = Timer-INT_ACTION_STARTTIME_MSEC  'calculate time passed

 If intElapsedTimeMsec > Environment("MAX_ACTION_TIMEOUT") Then
        CheckIfActionReachedTimeout = True
  exitaction
 else
   CheckIfActionReachedTimeout = false
 end if
end function

 

3 使用方法示例代码:

print CheckIfActionReachedTimeout()

 


TAG: QTP 判断运行超时

 

评分:0

我来说两句

Open Toolbar