Exit Action In QTP

Action Types In QTP :Exits the current action, regardless of its local (action) iteration attributes. The pass or fail status of the action remains as it was in the step prior to the ExitAction statement.

Note: The ExitAction statement and its return value are displayed in the Test Results.

Syntax

ExitAction[(RetVal)]



Argument

Type

Description

RetVal

Variant

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

In the following 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.

' Action "CheckForm"

FormVersion = RunAction("GetFormVersion", oneIteration)

If FormVersion = 2 Then

       Call RunAction("CheckOldForm", oneIteration)

Else       

       Call RunAction("CheckNewForm", oneIteration)

End If

' Action "GetFormVersion"

If IsNewForm Then

       ExitAction(2)

Else

       ExitAction(1)

End If

Post a Comment

Previous Post Next Post