HP QTP Utility Statements : CallServiceTest Statement
September 10, 2018
HP QTP Utility Statements : CallServiceTest Statement
Welcome to this post! – ” HP QTP Utility Statements : CallServiceTest 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 : CallServiceTest Statement” consists of concept discussion and general interview questions which have been part of many interviews either external or internal. 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.
CallServiceTest Statement
Abstract
The callservicetest statement is used when a service test exists in your test suite and requires you to associate the same via this statement. 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 call a service via vbscript?
- Can you associate a web service using utility statement and execute the same?
- What are the objects and parameters of CallServicetest statement?
- is CallServiceTest is an object or statement?
- How to insert a call to a Service Test test?
Discussion
When you create the service test using the dialog box provided in QTP or via new service test in UFT, you fill up the URL (wsdl), set parameters and http methods. Once the creation and unit testing of this test is done then you can use the CallServiceTest test statement to run the same test which you have created just now.
Hence, the main purpose of the CallServiceTest statement is to Load and run the desired “Service Test” test when this step (statement) runs. You can also add this CallServiceTest statement using the “Call to Service Test” Test dialog box. The Service Test test is loaded only when the step runs (and not when the test opens).
There are few Prerequisites to run the service via this statement:
- Service Test must be installed on the QTP computer.
- A Unified Functional Testing license must be loaded.
“Call to service test” Test dialog box
Below are the steps for Creating the service test using the “Call to service test” Test dialog box.
Use the Call to Service Test Test dialog box,
To create new :–
Select Insert > Call to Service Test Test.
To modify an existing call :-
Right-click the step and select Edit Call to Service Test Test.
Point to note here:
- You cannot add this statement manually in the Expert View.
- If you are running maintenance then be advised as there will be no warning if the called Service Test test is moved or deleted.
Syntax
var_CallServiceTest = CallServiceTest(ServiceTestName, ServiceTestParams)
Parameters
Let’s see some parameters of this statement and usage description:
Argument | Type | Description |
ServiceTestName | String | The name of the Service Test test for which you have inserted a call using the Call to Service Test Test dialog box.
The modification is also done by using same name, |
ServiceTestParams | String | The XML file containing the list of test arguments and the values you defined in the Call to Service Test Test dialog box. |
Return Value
Variant. Returns an output value in XML format.
Example:
QTP inserts a step that calls the Service Test test, for example:
'example var_CallServiceSt = CallServiceTest ("Myservice.st","MyserviceParams-1.xml")
QTP also creates an XML file containing the parameter values used in the Service Test test and stores this file in the action folder.
In the above example, the file is named MyserviceParams-1.xml, and it is stored in C:\Program Files\HP\QuickTest Professional\Tests\MyServiceTest\Action1
This brings us to the end of our discussion on “HP QTP Utility Statements : CallServiceTest 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.