ExitAction statement In QTP

Description

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.
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

0 comments:

Post a Comment