-3

How to test the data appearing in an XML file?

Can someone please guide me, how should I write test cases for a complex XML file?

I have to test an XML file which has various child-subchild elements?

There are many elements which have required attribute, and optional attribute.

How should I test the data generated from application is correct?

Any suggestion.

Sample XML file looks like below

<Business type="regular" time="2015191250">
    <ProductList>
        <Product Available="True" Name="Book1" Code="BBCD">
        <Product Available="False" Name="Book2" Code="BaCD" link="ww.aab.com">
        <Product Available="True" Name="Book1" Code="BBCD">
    </Productlist>
    <CustomerList></CustomerList>
    <Address></Address>
</Business>
Filburt
  • 17,626
  • 12
  • 64
  • 115
code-decode
  • 29
  • 1
  • 5
  • 1
    I'd suggest you provide an example of the specific constraints you would like to test. As it is now there's no possible way to answer your question because we cannot guess what your data looks like and what constraints you have. – Filburt Dec 31 '14 at 11:08
  • Hi, Sample data of my XML file looks like this
    – code-decode Dec 31 '14 at 11:20

1 Answers1

0

With no more clues, i suggest to write a test proyect using DOM to verify your XML's contents.

Depends of the programming language, you have to use different methods to do that.

Ex: In VB.NET , you can use the class xmlDocument

General Information of this class: http://msdn.microsoft.com/es-es/library/system.xml.xmldocument%28v=vs.110%29.aspx

With .load, .attributes, .selectNodes, .save , you can start counting number of childrens.. attributes... validating their values..