https://www.qatechies.com

HP QTP Utility Statements : ExecuteFile Statement

technical-concept-uft

HP QTP Utility Statements : ExecuteFile Statement


Welcome to this post! – ” HP QTP Utility Statements : ExecuteFile 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 : ExecuteFile 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.

 

ExecuteFile Statement

Abstract

The ExecuteFile statement is used to get the custom functions, defined and stored in external function file, to be executed  and make available for the current script. The scope of the functions contained within the function file becomes global. These functions then can be used across script to support the functionality needed.

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 custom function file loaded into QTP?
  2. Can you associate the custom function file with the current action of the test case?
  3. What are the objects and parameters of ExecuteFile statement?
  4. is ExecuteFile is an object or statement?
  5. How can you debug the custom function file loaded using ExecuteFile statement? or Can you debug function file loaded using ExecuteFile Statement?

 

Discussion

When you create the test using some framework like hybrid, keyword driven or data driven, there is always a scope of adding new functions to the framework. These custom function can be temporary and can be permanent in terms of usage. Temporary in the sense that you just have to register the function for your script to execute and later you deregister the same function. But permanent remains in your function library folder which can be used across scripts.

Hence, officially the main purpose of the ExecuteFile statement is to execute the VBScript statements in the specified file. After the function file runs or executed or loaded, the definitions (functions, subroutines, classes, etc.) in the file are available from the global scope of the action’s script.

 

Difference between the LoadFunctionLibrary and ExecuteFile

There are some differences between LoadFunctionLibrary and ExecuteFile which are as follows:

In LoadFunctionLibrary statement you can specify multiple function files but in case of ExecuetFile you can specify only one.

In LoadFunctionLibrary statement you can also debug the function file loaded in to the scripts. The debug pointer or marker works in this case, unlike ExecuteFile statement where debug marker or pointer’s is skipped.

 

Points to note here:

  1. You can’t debug a file that is called using an ExecuteFile statement, or any of the functions contained in the file in any vbscript or function file format (.qfl,etc).
  2. In addition, when debugging a test that contains an ExecuteFile statement, the execution marker may not be correctly displayed.
  3. The scope of functions, classes etc defined in the function file have a global scope.

 

Syntax

ExecuteFile File

 

 

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

 

Argument Type Description
File String The absolute or relative path of the custom function file to execute.

 

Return Value

none

 

Example

The following example executes the MyCustomFunction VBS file in order to use the “WebClick” function in the action script.

'ExecuteFile  example

  ExecuteFile "MyCustomFunction .vbs"

 ' Defined in MyCustomFunction .vbs
 WebClick(Browser("home").Page("User").Webdit("text1") )

 

 

 

This brings us to the end of our discussion on “HP QTP Utility Statements : ExecuteFile 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 !!