EXIT Statements
The following are the exit statements used in
different scenarios,
- ExitTest
- ExitTestIteration
- ExitAction
- ExitActionIteration
- ExitComponent
- ExitComponentEx
- ExitComponentIteration
ExitTest:
Exits the entire UFT test or ALM business process test,
regardless of the run-time iteration settings.
Syntax:
ExitTest[(Return
Value)]
Argument: Return Value
Type: Variant
Description: Optional. The Return
Value.
Example:
Result = Browser("Welcome: Mercury
Tours").Page("Welcome: Mercury
Tours").WebEdit("username").Check (CheckPoint("username")
)
ExitTest
The above test exits if the checkpoint on the
username edit box fails.
ExitTestIteration:
Exits the current iteration of the UFT test or
ALM business process test and proceeds to the next iteration, or exits the test
run if there are no additional run-time parameter iterations.
Syntax
Argument : RetunValue
Type : Variant
Description : Optional. The return value.
Result =
Browser("Welcome: Mercury Tours").Page("Welcome: Mercury
Tours").WebEdit("userName").Check (
CheckPoint("userName") )
The above example uses the ExitTestIteration
statement to end the test run if a checkpoint on the userName edit box fails
ExitAction:
Exits the current
action, regardless of its local (action) iteration attributes. The ExitAction
statement and its return value are displayed in the Run Results.
Syntax
Argument :
ReturnValue
Type : Variant
Description: Optional.
The action's return value. The value can be a string or number, but it must be
a constant value. It cannot be the name of a variable. The value is returned to
the statement that called the action.
Example:
' Action "CheckForm"
In the above
example,the CheckForm action calls
the GetFormVersion action. The
GetFormVersion action checks whether the form is in the new version or the old
version. If IsNewForm is True, then the action uses the ExitAction
function to return the value 2. If IsNewForm is False, then the action uses the
ExitAction function to return the value 1. The CheckForm action stores
the value returned by the ExitAction statement in the FormVersion variable, and
uses it in the following steps.
ExitActionIteration:
Exits the current
iteration of the action. The ExitActionIteration statement and its return value
are displayed in the Run Results. Using this statement
overrides other end-of-iteration settings.
Syntax
Argument : ReturnValue
Type : Variant
Description : Optional. The action iteration's return value.
The return value is displayed in the run results.
Name =
DataTable("Name", dtLocalSheet)
The above example
uses the ExitActionIteration function to stop running the current action
iteration when the value in the current row of the Name column in the
action's data sheet is Ram.
Instr Function:
Syntax:
Instr(start,
string 1,string 2,compare)
strat:
starting position for each search and its optional.
string1: string being searched and its mandatory argument
string2: string searched for in string 1 and its mandatory argument.
compare-it’s
a numeric value indicating the type of comparison.
Compare
argument can have the following values,
0-for
binary comparison
1-for
text comparison
Instr function returs the following values,
0 -if
string1 is zerolenth
Null- if
string1 is null
Start position-if
string2 is zero length
Null-if
string2 is Null
0-if
string2 is not found
Postion at which
string is found-if string2 is found within string1
0-if
start>len(string2)
Example:
Dim string1, string2, Result
string1="Quick Test Professional"
string2="Test"
Result=instr(1, string1,string2)
msgbox Result
string1="Quick Test Professional"
string2="Test"
Result=instr(1, string1,string2)
msgbox Result
Output:
ReplyDeleteThanks for publishing this blog, really awesome. Only experienced professional can do this.
QTP Training in Chennai
QTP Course in Chennai
Best QTP Training Institutes in Chennai
QTP Training in Porur
QTP Training in T Nagar
LoadRunner Training in Chennai
Best Loadrunner training institute in chennai
performance testing training in chennai