HP QTP Utility Statements : ExitTestIteration Statement
September 10, 2018
HP QTP Utility Statements : ExitTestIteration Statement
Welcome to this post! – ” HP QTP Utility Statements :ExitTestIteration 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 : ExitTestIteration 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.
ExitTestIteration Statement
Abstract
The ExitTestIteration statement is used to get the current iteration of the test exited and return to the parent calling procedure. This statement is called as an utmost 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:
- How to get current test exited? or How to exit from current test?
- Can you use the ExitTestIteration and ExitActionIteration one after the other?
- What are the objects and parameters of ExitTestIteration statement?
- is ExitTestIteration is an object or statement?
- What happens to next test in order of execution when prior one is exited?
- Can you use the return value of the exit component into another business process test component?
Discussion
Suppose you have created the test with several components. Each component of the Business Process test needs to be executed in order of execution and each of the component loops through as per data sheet i.e. in iterations of rows and columns. Similarly you might have the QTP or UFT test cases which are in iteration and where in you would like to exit in some cases, like unexpected errors, data sheet specific column value, business cases etc. you might want to exit the test. Now, exiting the component or test and returning a status of the current component and test can be done via this ExitTestIteration Statement.
Hence, officially the main purpose of the ExitTestIteration statement is to exits the entire QTP test or QC Business Process Center , regardless of the run-time iteration settings. The pass or fail status of the test remains as it was in the step prior to the ExitTestIteration statement.
Points to note here:
- The ExitTestIteration statement and its return value are displayed in the Run Results.
- The return value can be stored in output parameter to be used in other Business Process Components or Tests as an input parameter.
Syntax
ExitTestIteration [(RetVal)]
Let’s see the parameters and their usage description for this statement:
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 userPassword edit box fails.
'ExitTest Example res = Browser("Home").Page("Login Page").WebEdit("userPassword").Check ( CheckPoint("userPassword") ) If res = False Then ExitTestIteration End If
This brings us to the end of our discussion on “HP QTP Utility Statements : ExitTestIteration 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.
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.