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.
QTP列表项恢复方案
本文介绍了一种在QTP中处理找不到列表项或菜单项的恢复方案。通过使用Recovery_ListItemIsNotFound函数,可以在测试运行时自动选择列表中的随机项以避免测试中断。文章提供了该函数的实现细节。
1585

被折叠的 条评论
为什么被折叠?



