QTP恢复场景-处理找不到列表项或菜单的情况
上一篇 /
下一篇 2011-02-12 17:23:01
/ 个人分类:QTP
relevantcodes.com的这篇文章《Recovery Scenario Test Run Error: Item in list or menu not found》介绍了QTP中用Recovery Senario处理找不到列表项或菜单的情况:
http://relevantcodes.com/recovery-scenario-test-run-error-item-in-list-or-menu-not-found/
在定义的恢复场景中使用了Recovery_ListItemIsNotFound这个函数来对错误作出处理:
Function Recovery_ListItemIsNotFound(Object, Method, Arguments, retVal)
Dim sAllItems, arrAllItems, intItem
With Object
'Retrieve all items from the Listbox
sAllItems = .GetROProperty("all items")
'Split 'all items' using a delimiter ";" into an array
arrAllItems = Split(sAllItems, ";")
'Select a random number
intItem = RandomNumber.Value(LBound(arrAllItems), UBound(arrAllItems))
.Select "#" & intItem
Reporter.ReportEvent micInfo, "ListItemIsNotFound", "Item: " & .GetROProperty("value")
End With
End Function
函数的各项参数的意义如下:
Object as Object: The object of the current step.
Method as String: The method of the current step.
Arguments as Array: The actual method's arguments.
Result as Integer: The actual method's result.
收藏
举报
TAG: