hp-uftdata-driven-testsuft-apiuft14

Error handling in UFT


Please suggest me how to handle the scenario. Problem is supposed I got an error at statement 2 during execution of the first iteration for Row 1 from excel then how to skip remaining statement and start the execution of statement 1 with excel row 2.

Browser("ABC").Page("ABC").WebEdit("ABC").Set "123"
Dim i
Dim iRow
iRow = datatable.GetRowCount

For i = 1 to iRow

Statement 1- Browser("ABC").Page("").WebEdit("ABC").Set DataTable("DT", dtGlobalSheet)
Statement 2- Browser("ABC").Page("").WebEdit("ABC").Set DataTable("DT", dtGlobalSheet)
Statement 3- Browser("ABC").Page("").WebEdit("ABC").Set DataTable("DT", dtGlobalSheet)
Statement 4- Browser("ABC").Page("").WebEdit("ABC").Set DataTable("DT", dtGlobalSheet)
Statement 5- Browser("ABC").Page("").WebEdit("ABC").Set DataTable("DT", dtGlobalSheet)

datatable.SetNextRow

Next

Excel sheet

Row 1 Row 2 Row 3


Solution

  • step1) create a new Action with Name "Action2" and put the code from inside for loop

    step2) import data to Action2 local data table

    step3) create a recovery scenario enable check on every line with recovery function as

         function RecoveryFunction()
             ExitActionIteration
         End function
    

    step4) from Action1 call Action2 with allIterations