UFT-API-Testing using the Validate XMl function (1425 Views)
Reply
Occasional Visitor
Posts: 1
Registered: ‎03-06-2014
Message 1 of 4 (1,425 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.

 

 

Advisor
Posts: 18
Registered: ‎06-19-2013
Message 2 of 4 (1,398 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.
Occasional Visitor
Posts: 1
Registered: ‎05-21-2015
Message 3 of 4 (257 Views)

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

Hi,

 

Can anybody please help me to understand how to validate XML data with in UFT API test?

I have some XML responses where response body look like this-

 

 

<Tariff1>

<Code>Value</Code>

<Desc>Value</Desc>

<Tariffelement1>

<A>Value</A>

<B>Value</B>

</Tariffelement1>

<Tariffelement2>

<D>Value</D>

<E>Value</E>

</Tariffelement2>

</Tarrif1>

<Tariff2>

<Code>Value</Code>

<Desc>Value</Desc>

<Tariffelement1>

<A>Value</A>

<B>Value</B>

</Tariffelement1>

<Tariffelement2>

<D>Value</D>

<E>Value</E>

</Tariffelement2>

<Tariffelement3>

<D>Value</D>

<E>Value</E>

</Tariffelement3>

</Tarrif2>

<Tariff3>

<Code>Value</Code>

<Desc>Value</Desc>

<Tariffelement1>

<A>Value</A>

<B>Value</B>

</Tariffelement1>

<Tariffelement2>

<D>Value</D>

<E>Value</E>

</Tariffelement2>

</Tarrif3>

 

Thanks for the help in advance !!

 

Advisor
Posts: 15
Registered: ‎05-06-2015
Message 4 of 4 (222 Views)

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

The validate XML just checks the given xml against the xsd file provided. 

 

What do you mean response? Response from where/what?

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.