05-23-2018, 04:04 PM
Do you mean as soon as the FIRST pass/fail is encountered , the loop should exit ? If yes, use this code
if you want exactly 1 pass and 1 fail value, use flags to do some manipulation.
Code:
Function VerifyHistory()
Dim funcName : funcName = "VerifyHistory"
Dim setupFuncName : setupFuncName = "SETUP|" & funcName
rowcnt = Browser("Br").Page("Pg").WebTable("Tbl").Rowcount
For i = 2 To rowcnt
actual= Browser("Br").Page("Pg").WebTable("Tbl").GetCellData(i,4)
If Instr(parameter.Item("Activity"),actual)>0 Then
ResultOutput "Pass", "Expected:"¶meter.Item("Activity")&vbnewline,"Actual: "&actual
Exit For
else
ResultOutput "fail", "Expected:"¶meter.Item("Activity")&vbnewline,"Actual: "&actual
Exit For
End If
Next
End Function
if you want exactly 1 pass and 1 fail value, use flags to do some manipulation.
Code:
Function VerifyHistory()
Dim funcName : funcName = "VerifyHistory"
Dim setupFuncName : setupFuncName = "SETUP|" & funcName
Dim flagPass, flagFail
rowcnt = Browser("Br").Page("Pg").WebTable("Tbl").Rowcount
For i = 2 To rowcnt
actual= Browser("Br").Page("Pg").WebTable("Tbl").GetCellData(i,4)
If Instr(parameter.Item("Activity"),actual)>0 Then
ResultOutput "Pass", "Expected:"¶meter.Item("Activity")&vbnewline,"Actual: "&actual
flagPass = 1
else
ResultOutput "fail", "Expected:"¶meter.Item("Activity")&vbnewline,"Actual: "&actual
flagFail = 1
End If
If (flagPass = 1 and flagFail = 1) Then
Exit For
End If
Next
End Function