Exit Statements in UFT – User friendly Tech help
Let us discuss various Exit statements which are quite useful in automation testing Using UFT.These statements are part of Vbscripting(Latest version) and when implanted in the code provides better control on the flow of execution of automated Tests.
It is also used in Error handling as and when some exception occurs we can use ‘Exit’ statements.
- Exit Do
- Exit For
- Exit Function
- Exit Property
- Exit Sub
1.Exit Do, it is used to Exit a Do….Loop Statement. It transfers the control to the statement following the loop statement.
n‘Code to Exit, when condition is meet
niVar = 1
n ‘Printing the value Print iVarn
‘Incrementing the value
n iVar = iVar +1
n ‘Incase value is ‘5’ then exit do
n If iVar = 5 Then
n Print “Exit Do”
n Exit Do
n End If
nLoop while iVar