UFT-API-Testing using the Validate XMl function (496 Views)
Reply
Occasional Visitor
ADASablons78
Posts: 1
Registered: ‎03-06-2014
Message 1 of 2 (496 Views)

UFT-API-Testing using the Validate XMl function

Hello every one,

 

If someone can help me i need several light in usign a the 'Validate XML" function for a test API in UFT.

I'm more familiar with GUI testing and recently I had to focus on the test API so I am little bit new with Service Test.

 

The work flow of my test is quite simple :  

1. using a function of a web service 

2. check the syntaxe of the response with

3. check some data in the response

 

My problem is at the step 2 where Im using the function "Validate XML" with  XSD file to check the syntaxe of the response : whatever the parametization I do a always get a false status but if i see the response by myself I do not see any problems of syntaxe :all tags expected are well present in the reponse.

 

If anyone can help my how to do the well parametization for this function it would be nice.

 

Thanks a lot.

 

 

Please use plain text.
Advisor
Jupalli
Posts: 17
Registered: ‎06-19-2013
Message 2 of 2 (469 Views)

Re: UFT-API-Testing using the Validate XMl function

[ Edited ]

Are you able to manually validate the XML with the xsd without any errors?
I use the tool Altova Spy to validate the XML against the schema manually. Based on the sensitivity of the data you may use free online tools like this one [http://www.utilities-online.info/xsdvalidation/#.UxjatfldWW8]

 

Try below steps to validate the XML via UFT tool, hope this helps

1.  In UFT API test, add Read from File activity [under standard activities > File] onto the canvas

2.  Under Read from File Properties, set the following Input values:
             --  File path = {path of the xml to validate}
             --  Encoding = Automatic
3.  Under Read from File activity, add Validate XML activity [under standard activities > XML] onto the canvas
4.  Under Validate XML Properties, set the following Input values:
             --  XML string = {Click on the link icon > point to the Read from File’s Content output property}
             --  Import XSD to test folder = false
             --  XSD file = {path of the schema (.XSD) file}
5.  Run the test and look at the Run Results Viewer’s Validate XML Captured Date section. You should now see the message Validation ended successfully.

-- Opinions expressed in my postings are mine alone, and do not reflect the opinions of my employer. No warranties express or implied for any solution/suggestion posted.
Please use plain text.
The opinions expressed above are the personal opinions of the authors, not of HP. By using this site, you accept the Terms of Use and Rules of Participation