It has been always a great experience for me to test web services. The way it extends the web infrastructure to provide the method/path to applications to connect to other applications is really interesting. Automating Web Services using QTP have always been easy and simple to use. HP Service Test and QTP Web Service Add-in are great solutions for Web Services Testing.I have written some posts on Web Services Testing using QTP earlier at LearnQTP. I hope you must have enjoyed and learned about it from there.
With the launch of UFT, HP has now removed web service add-in and combined HP Service Test with QTP, which is definitely going to give an entirely new direction to automate Web Services. However Web Service Add-in is not completely removed, but it has been made hidden into UFT. You can find the way to unhide it in our next post, stay tuned. In this post, We will see that how things are different now for Web Services Testing in UFT. We will discuss and Create a SOAP Web Service Test.
I have already explained the important key points about web services in my older post, Still, for your reference and convenience, I will keep them here as well in brief. In SOAP-based web service testing, WSDL plays an important role. Web Services Description Language (WSDL) is an XML-based language for locating and describing Web services. Now as the Web Service is powered by the web application server that uses SOAP to understand and speak with web services and delivers information in XML. Simple Object Access Protocol (SOAP) is an XML based protocol to exchange information over HTTP. To locate the web services WSDL documents are indexed in searchable Universal, Description, Discovery and Integration (UDDI) business registries. Learn more about SOAP here.
The very first step to creating a test in UFT is to Import the WSDL. We have API Test in UFT for such testing. We will be using the same example of the TempConvert web service provided by W3C. This web service has two methods ‘CelsiusToFahrenheit’ and ‘FahrenheitToCelsius’ and simply takes the temperature and converts it to the required.
Below is the WSDL for the Service. http://www.w3schools.com/webservices/tempconvert.asmx?WSDL To Create an API Test, Select File > New >Test >API Test and name the test. Click on Import WSDL on the UFT toolbar. This gives you two options –
- Import WSDL from URL or UDDI – Select this option to import WSDL from the URL
- Import WSDL from File or ALM Application Component – Select this option, if you have the WSDL file or from ALM Component
In this example we will select Import WSDL from URL or UDDI and enter the wsdl url mentioned above (http://www.w3schools.com/webservices/tempconvert.asmx?WSDL) in the Address field and Select URL option and Click OK to proceed. UFT imports and read the methods and parameters of web service to work with. You can find all the methods or operations of web services at the ToolBox pane under Local Activities. In this case, you will find two operations under TempConvert Service as in the snapshot below. These operations can be used to test the web service. To use an operation to test, you just need to drag the operation from Local Activities area and drop onto the canvas area under test flow. Let’s say you drag FarenheitToCelsius method to the test flow. This method needs a parameter temperature value to be passed. You can find this under Properties Pane, Input/Checkpoints tab. Select Grid or Text view. Grid Shows Properties and parameters in tabular format and the most convenient one. Text view shows in XML format. The Input section in the Grid shows Envelope and Body section of the request XML.
Parameters for Requests can be found in the body section. In this case it is Farenheit. Enter Value of Farenheit, Save the test and that’s it. Your test is ready and can be executed now.
Once Executed you get the result Pass or failure of service test, including the SOAP request and response details. These details also include the exact request sent and the response received.
That was pretty easy to use, isn’t it. Now lets say after importing the WSDL into UFT, we got some changes into the method or parameter. This leads us to update the WSDL we use in the test. UFT provides a feature to update the WSDL rather importing it again. We get two options here, either update from the same location or from a new location.
It is very simple to add checkpoint as well. To add a checkpoint for your test,
GOTO Properties Pane > Input/Checkpoint tab > checkpoint section.
Expand body section you will find the parameter FarenheitToCelcius, check the validate checkbox Slect the equal sign and enter the required value (77) re-run the test and you will find it validated in the result. We are getting this result as Failed as we entered wrong expected value in the checkpoint expected value.
This was just for the demonstration purpose, you need to enter the exact expected value accordingly. In the same way, we can test simple as well as complex operations of the web service easily using UFT. If you have got some more info about Web Service Testing using UFT or have any doubt or questions, let us know via the comments below.
Hi,
Can we prepare Framework for webservice test cases?if yes,please guide me how we can do it.
Thanks®ards
Ranjeetha.Pujari
Hi Ranjeetha,
Yes, we can have framework designed for web services testing and it will not be anything different than any framework that you use for web, wpf etc.
The only difference will be, the way you would like to have your request and response for the methods.
here is an example for a typical scenario – you can have your parameterized requests in flat files. this can be in a form of template for a particular method with placeholders for the input data. Same way the response files can be saved as a flat file and can be compared with the baselined response.
in QTP you can make use of XMLWarehouse to parameterize your requests and create checkpoint for the responses using webservices add-in.
Sanket, how can we load the template XML\flat files dynamically to particular method in service test, I believe there is only two ways we can load the XML into method.
1.Import from file
2.Paste the xml into activity
If any other way to load xml dynamically during execution as u said, please describe.
Thanks in advance…..
Hi Saket,
How to edit end point in WSDL after importing WSDL into UFT
Regards,
Suneel
Hi Suneel,
here are the steps to change/edit endpoint in UFT after you have imported WSDL
Go to Properties pane > select a service method > select general tab
You will find the property – Transport , where you have two select options
– HTTP
– JMS
Select HTTP and expand
You will see Endpoint Address there, which you change there. You have the option there to change it dynamically as well.
Hope this helps.
Thanks.
I will need to automate following scenario using UFT for POC so can you please let me know if it is possible to call webservice by passing XML file without using WSDL etc
I want to scemulate following scenario.
1) Create and Load of XML file
2) Call Web service using XML file/data
3) Receive that Web service as service request from Adapter
4) Receive web service call from adapter
5) Extract XML payload
6) Load expected XML output
7) Compare actual andexpected XML files
8) Record result Pass / FAIL and no further
Please can you reply to me at kapil.jain@cgi.com.
Thanks in advance 4 all your help.
Regards
Yes Kapil, I think it will be possible. We have the option for importing wsdl from file, where you can import wsdl or import wadl from a file on your local.
Different validation you can do using checkpoints.
Thanks Saket but we are not using WSDL. We are using XSD as opposed to WSDL to build/format messages although not being a webservice expert I’m not sure exactly how XSD would be used by a system/test tool to physically build a message.
if we were using WSDL the test tool (in the case of UFT)could effectively access the specific WSDL from the webservice itself then its text editor can be used to build up the message.
now without using XML when we load any xml and then call webservice using that XML and after that when we receive some response then verify point 3,4,5,6,7,8.
can you please let me know if that’s possible in UFT or NOT and if yes then how ?
see if this helps
http://stackoverflow.com/questions/19527222/create-a-web-service-request-xml-from-xsd
I need to automate following scenario for UFT Proof of concept.
1) Load of XML file
2) Call Web service using XML file/data
3) Receive that Web service as service request from Adapter
4) Receive web service call from adapter
5) Extract XML payload
6) Load expected XML output
7) Compare actual andexpected XML files
8) Record result Pass / FAIL and no further
In UFT is it possible to create and load XML file then call web service using XML file/data?
Is it possible to create a Mock webservice in UFT for POC testing?
I think point 2 is the tricky one here and I don’t know how to call webservice in UFT without using WSDL.
Thanks in advance for your help.
Regards
KAPIL
HI,
I did the set up by importing WSDL file and this is working fine for me. But I have a separate scenario too. It’s like I need to do the set up over JMS (SOAPoverJMS) where I don’t have any WSDL file. I have all the endpoint URL and request response queue details.can you please suggest me how to do this?I appreciate your help on this.Thank you.
Not sure about SOAPoverJMS, I will update as soon as I get anything on this.
I want to export request xml andautomate?
Is it possible to import request xml directly as i dont have wsdl.
Please let me know if any one has solution or way around.
Thanks.
hI Saket,
Could you please let me know the exact meaning of parameterization for webservices. Is this same as how we parameterize hard coded values using datatable.
Yes Jyoshna, its same as you do normally. let me know if you any specific question or difficulties around this.
which method to call data base query between UFT and Web services? i am using uft for automation,
i
Hi Syed, Sorry but I did not get your question clearly. can you elaborate?
For the WSDL i loaded, I have submitted the request by loading the xml. The XML got successfully loaded. But, after execution, I get “Report not avilable” pop-up message. And, I donot know where to look for the response for the request.
Please help me with the same.
I will look into this if there is some thing from UFT side and get back. meantime just check if everything works at your service and there is no issue.
Hi. that worked fine. I launched UFT as admin and the issue got resolved.
I have another doubt.
Is it possible to load the request xml dynamically.(i.e.,)is it possible to provide the path to the xml file through environment variable and load the xml dynamically.
Hi,
My application is Siebel CRM using Uft 11.5 prepared script but while executing script Weblist items are not get select in field, i tried excel method and getroproperty both are not supporting please help me
Can you please elaborate your question with what exactly you are trying. pls paste some code snippet as well where you find issues?
Hi I need to automate following scenario for UFT in 11.5, as i am very new to QTP, if any one helps here that would be greatful.
1) Load of XML file
2)Modify the some fileds in xml
3)save
4)Call Web service using XML file/data
5) Load expected XML output
6) Compare actual andexpected XML files
7) Record result Pass / FAIL and no further
Once you have web service imported, you automatically get the request in xml format. you can parameterize the values of xml fileds there.
when the reuest is sent, and you get the response, save the response and compare with expected xml using xmlutil object.
thnks
Can you help me how can i find the xmlutil object.I just ran one web service it is returning the response as expected. But how can i automate that.
How to Select System Date from DatePicker
my script:Browser(“micclass:=Browser”).Page(“micclass:=Page”).Link(“Index:=29”).Click
here date September 29th index value is Index:=29 but tomorrow date will be September 30 is going to happen but index it won’t change so my script will fail. index should change dynamically or is there any other method to select sep 30 dynamically please help
try text propoerty
Text property is not supporting so only used Index Property.
please share the automation challenges in real time.atleast two challenges ineed.i am tryin for automation testerwith3years
Hi saket ,
when i try to import wsdl in UFT it is directing me towards default browser instead of importing wsdl. can you please help me to solve this issue
Hi Saket,
We have been testing web services using Soap UI and now planning to automate all these tests using UFT.
What would be the best approach for this?
I am new to Web Service automation. Could you please let me now how
to load WSDL and certificate using VB Scripts.
Hi Saket,
Do you have any SOAP UI framework for Webserviceautomation.
Myrequirement:
I have to pick test case read from excel & pass testcase in excel
Unfortunately No. I dont have a framework on SOAP UI to share with you.
for web services recently using webservice addin of QTP11. When I input wsdl url through the web services wizard and click next,I get this message: “The selected service is invalid. Please select another service.”
I did the same webservice testing earlier using QTP 10 in different system and there it was working fine, now the
system set up is different and QTP version is different
So what might be the issue here?
I am using UFT api test to automate webservice which return response with multipart/related content type. I am not able to read data from response as it is not full xml. Anyone has any similar issue and any solution for that?
I was using SoapUi for WebService Testing and started using UFT Api test today.
In Soap UI, deault request structure is SOAP message i.e starting tag is but deault request for same webservice in UFT API test is normal xml i.e starting tag is and then following by
any advise if there is any issue with that??
Hi,
HowtouseEVENTS
i.e
Script.TestUserCode
inWebserviceswhichisdisplayinginWebservicestest,pleaseprovidemeexampleorthis
Hey Saket,
Is there anyway we can use/import UFT-Api Script in UFT-GUI script?
Actually I have a usual framework for functional automation, where I want to call some SOAP Request. That’s why thinking to use flexibility of UFT-API.
Thanks
Hey Saket,
I have a scenario where i have to automate soapui for two environment. first is single tenant and second is multiple tenant. In multiple tenant, i have to provide username and password details in authentication and security related setting of SOAPUI. How to automate it?
Thanks
Nice work, I have a question on Groovy, can you explain when and why we use Groovy for service test.
in brief – Groovy scripting mostly being used to create assertions or for pre-requisite steps (before/after) for your test steps. let us know if you any specific questions.
I’ve been working with QTP/UFT since 2002 but have never used it with WebServices. By your article, it looks pretty easy to get ramped up. Any resources or primers available out there to get a good high-level and low-level understanding?
Hello Saket,
Thank you for sharing your knowledge its kind of you. I am currently working on a UFT API service testing project and I have a question If I may ask.
1. Can you share different codes that I can use for my test
2. could share a framework I can apply to my test
Thank you for all you do
Thanks Kendal. I am glad you liked the post and its helpful for you.
I will be happy to answer or clarify your question, but before I proceed I would like to know more about your requirements.
The questions seems to be very generic. Based on the specific requirements or your project type, I will be able to suggest a framework or can provide some code snippets.
Thank you for your prompt response, if possible can I send you an email with screen shot and detail of what my project covers. If you would like you can email me @ endalemp@yahoo.com and I will replay with questions. Thank you in advance.
Sure Kendal. alternately you can reach us from contact page.
Hi Saket,
I need to load test one of our web services, I have a ‘normal’ GUI test which generates the XML files, and my API test works fine when I ‘Load XML’ or even paste the XML from my files into UFT, to be a reliable test I need to be able to fire thousands of files at this service, but I cannot figure out how to do this, could you provide any pointers please? ideally I would provide a data source (a directory) then UFT goes through each file sending them to the web service.
regards
Nelly
Yes Nelly, I would also suggest the same way to have a data source to fire all your requests. moreover if the request is same and its just the data you need change in each request, you can have the data in Excel or any other database and parameterize your request.
Thanks for the response Saket, could you tell me if it is actually possible to just provide a directory which includes individual XML files? If so am I doing it the correct way?
From the API test > View > Data > Select XML > Select Use existing > select my folder containing XML files > Ok > error “Unable to load Data Source; The selected folder doesn’t contain a valid XML data source” – however, I am able to load these exact same files the other way, i.e. ‘Load XML’ . I do have a support contract with HP / UFT and an active service request about this load test, but they are taking their time responding to me 🙁
regards
Nelly
Hi Nelly,
Is your issue resolved? Even am facing a similar issue
If I want to have signature then I need place .jks keystore. please provide me the step by step process to add the .jks file in HP service test.
I will leave for others to help if anyone has experience working with and help out here.
if anyone ware of this please help me out …….
Hey Venkatesh,
I am very sorry, I will not be able to help with your requirement now. I did not get chance to work with .jks files.
Hi there,
.jks is , not yet, supported by UFT.
But as a good customer of HP they promised to work on it and we should receive a BETA pretty soon.
Contact your sales rep and ask him to reach out to the product owner.
B
Good morning,
I have created an API test script using UFT tool, basically, the script is pulling the data from a database, I concatenate the two tables with two query in the script and created three select Data in the UFT canvas, today morning i ran the script and it is still running. Do you guys have any idea about it?
Inline image 1
I could not get the question, will be able to help if you can elaborate.
Hi saket,
can you provide me an idea , how to generate and import SSL certificate for any rest call
How can i call an input xml from a data table,
Hi Saket,
Can you please let me know how to import the SSL certificates related to the WSDL in UFT?
I was able to get response but checkpoint fails. After further investigation I noticed that the response in the log is in HTTP Body format instead of SOAP. I am refering from Result Details>Capture Data >Web Service Call HTTP Snapshot.
hi saket. I need to automate some of the test cases which I will run in soap UI
sure, tell me more about your requirement
Hi Saket,
Is it possible to have a common tests script as a pre-requisite and get it triggered before the test?
Example:
Pre-requisite: Generate the authentication token
Test Scenario: Get student details by ID (Pre-requisite auth token needed)
Thanks,
Shenaya
Yes, you can write a vbs outside UFT or main action within UFT, which can call other actions/test. with VBS as well you can write scripts to perform the pre-requisites and then trigger UFT.
or the other way round – if you have a vbs for pre-requisites then you can execute from UFT test as well prior to perform your next actions.
Hi Saket, pls add me in this group. I am beginner of API testing using UFT but I have 5 years experience in GUI testing using same UFT.
Hi after executing the script if i want to get response xml value what is the process?
Hi Saket,
Can you please provide me some information on UFT continuous integration with Rally tool. is it possible to do with UFT API testing? or any procedure to do this ?
Thanks in Advance
Sowmya
Hi Sowmya,
we will get back on this, could not get chance to explore on Rally yet.
How we provide a input to API Test from other GUI Test and vice versa? i am trying to automate web services, taking input from GUI test and need to pass as input to web services.. please share a idea, how we can achieve this? as previously i have not worked on API testing./
Hi, I am trying to test web services with UFT API Testing. Our situation is we do have .pem file (certificate) and that needs to be loaded and then I need to run SOAP requests. In SOAPUI NG Pro tool we do have preferences > SSL to load the certificate first and then I can run my SOAP requests. Whereas how can I or where can I load the .pem file in UFT for API testing?
Thanks,
Manju
see if this KB Item helpshttps://softwaresupport.hp.com/group/softwaresupport/search-result/-/facetsearch/document/KM759954
Hi Saket, I have 1.5 years exp in UFT automation on GUI, Here im facing the challenge like, i need to create the frame work for GUI and Web Services testing and i dont have any knowledge on web services testing. Coming to my Application After login into application on top we have 7 tabs , every tab has some separate options , every option provides a resposible page having some fields , lookups, calenders……, some major functionalities like saving the record which we entered fields, deletiong, search…..(some options providing another pages). Please help me to select frame work for GUI and Web services.
please provide the solution as soon as possible
santhoshkumar.vadapalli@gmail.com
Thanks in Advance
Thanks Santhosh, I will suggest to enhance your existing framework to support services testing as well. I will be able to help better, if you can tell me about your current framework and specific issue you are facing with web services.
Hi Saket,
I am new to API testing, we have got a PoC where , when i load the wsdl file the tags are empty and then i need to update the tags value and then we need to send the request.Please let me know how we do it in the UFT API Testing. And why do we have load XML option please explain