QTP恢復場景-處理找不到列表項或選單的情況

TIB發表於2010-03-19

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.

 

 

相關文章