ExitTestIteration ExitActionIteration ExitActionStatement QTP

Description

Exits the current iteration of the QuickTest test or Quality Center business process test and proceeds to the next iteration, or exits the test run if there are no additional run-time parameter iterations. The pass or fail status of the test iteration remains as it was in the step prior to the ExitTestIteration statement.

Syntax

ExitTestIteration[(RetVal)]



Argument

Type

Description

RetVal

Variant

Optional. The return value.

Example

The following example uses the ExitTestIteration statement to end the test run if a checkpoint on the userName edit box fails.

res = Browser("Welcome: Mercury Tours").Page("Welcome: Mercury Tours").WebEdit("userName").Check ( CheckPoint("userName") )

If res = False Then

       ExitTestIteration

End If

Description

Exits the current iteration of the action. The pass or fail status of the action iteration remains as it was in the step prior to the ExitActionIteration statement.

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

Syntax

ExitActionIteration[(RetVal)]



Argument

Type

Description

RetVal

Variant

Optional. The action iteration's return value. The return value is displayed in the run results.

Tip: To return a value to the calling action or test, use an output parameter.

Example

The following example uses the ExitActionIteration function to stop running the current action iteration when the value in the current row of the City column in the action's data sheet is Paris.

CurrentCity = DataTable("City", dtLocalSheet)

If CurrentCity = "Paris" Then ExitActionIteration("Skipping Paris")


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.

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

أحدث أقدم