https://www.qatechies.com

HP QTP Utility Statements : ExitAction Statement

technical-concept-uft

HP QTP Utility Statements : ExitAction Statement


Welcome to this post! – ” HP QTP Utility Statements :ExitAction Statement”.

If you are looking for HP UFT, QTP utility statements and their usages, then you are at right place. This post “HP QTP Utility Statements : ExitAction Statement” consists of concept discussion and usage discussion. Go ahead and enjoy reading…

This discussion will help you prepare well if you are going for the interview and can help you if you need the function to be used in your project test suite.

 

ExitAction Statement

Abstract

The ExitAction statement is used to get the current action exited and return to the parent calling action. This statement is called as a priority step or statement whenever defined. The statement in itself falls under the category of utility statements and not utility objects. Remember there is a difference between utility statements and utility objects.

Before we dig down deep into the usage let’s quickly visit some general questions.

In the interview usually, you might be questioned in different ways like:

  1. How to get current iteration of the action stopped?
  2. Can you use the exitAction and exitTest one after the other?
  3. What are the objects and parameters of ExitAction statement?
  4. is ExitAction is an object or statement?

 

Discussion

Suppose you have created the test with several actions. Each action needs to be iterated based on some condition. And in case of some unexpected errors, cases you might want to exit the action. Now existing the action and returning a status of the current action can be done via this ExitAction Statement.

Hence, officially the main purpose of the ExitAction statement is to Exit 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

 

 

Points to note here:

  1. The ExitAction statement and its return value are displayed in the Run Results.
  2. The return value in the ExitAction parameter must be a constant value either int or string.
  3. The return value cannot be the name of a variable.

 

Syntax

ExitAction[(RetVal)]

 

 

 

Let’s see the parameters and their usage description for this statement:

Argument Type Description
RetVal Variant Optional. The action’s return value.

 

Example:

In the following example, the CheckValidUser action calls the GetUserInfo action. The GetUserInfo action checks whether the user is  the new visitor or existing\old user.

 

A new function named IsNewUser, part of GetUserInfo action, is called to return the status as True or False. If its is True then the action uses the ExitAction function to return the value 2. If IsNewUser is False, then the action uses the ExitAction function to return the value 1.

The CheckValidUser action stores the value returned by the ExitAction statement in the GetUserInfo variable called ‘UserStatus’, and uses it in the following steps.

   

 

'Simple exitaction example

' Action "CheckValidUser "

UserStatus = RunAction("GetUserInfo ", oneIteration)

If UserStatus = 2 Then

    Call RunAction("CheckOldUser", oneIteration)

Else    

    Call RunAction("CheckNewUser", oneIteration)

End If


' Action "GetUserInfo "

If IsNewUser Then

    ExitAction(2)

Else

    ExitAction(1)

End If

 

 

This brings us to the end of our discussion on “HP QTP Utility Statements : ExitAction Statement”.

 

I really hope you have enjoyed reading this short post. If you have any doubt on this please feel free to add your comment below.


Other Utility Statements:
UNREGISTERUSERFUNC REGISTERUSERFUNC
SETLASTERROR GETLASTERROR
INVOKEAPPLICATION EXITTEST
EXITACTION EXITACTIONITERATION
DESCRIBERESULT EXECUTEFILE
EXITCOMPONENT EXITCOMPONENTITERATION
LOADANDRUNACTION PRINT
WAIT EXITTESTITERATION
LOADFUNCTIONLIBRARY CALLSERVICETEST
OBSOLETE MANUALSTEP
RUNACTION  

And if you like to read more on UFT or QTP Technical Interview Questions please follow below links: 

UFT Technical Interview Questions – Set 1

UFT Technical Interview Questions – Set 2

How to Download Resource From QC\ALM?

How to Upload Resource To QC\ALM?

 

Or if you prefer General Interview Questions please follow below links:

UFT General Interview Questions – Part 1

UFT General Interview Questions – Part 2

 


If you would like to keep track of further articles on UFT (QTP). I recommend you to SUBSCRIBE by Email and have new UFT articles sent directly to your inbox.

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.

advanced-floating-content-close-btn
https://pagead2.googlesyndication.com/pagead/js/adsbygoogle.js?client=ca-pub-5034726663464946 (adsbygoogle = window.adsbygoogle || []).push({});
advanced-floating-content-close-btn 
*************************** Do you want to learn TOSCA? Do you want to excel in Career? Try my New Courses: 1. Tricentis Tosca and Working with Excel   2. Tricentis Tosca and UI Automation Great News!!   Price has been slashed down for limited period of time.So Hurry!!! Click The Shown Links and Enjoy Learning. ***************************
 
error: Content is protected !!