2

I am working on some test automation where we are using xml documents for some test input. Now I am loading the xml documents to dataset and from dataset I am accessing the data.

For easy accessing, I have defined some classes with the similar xml schema.

Once I am done with the loading of xml into dataset, creating instances of my defined classes with the data from dataset. And accessing these objects from tests.

But here the maitainance of class structure and xml in sync is too difficult. If there is any change in the xml such as adding a new node, I have to change my class structure and the initializing the class to accomdate the new property.

I am looking for some methodology where I can avoid the keeping insync of xml and class structure. I am basically looking for some Automapper inbetween the xml and my C# classes.

-Naresh

3
  • 1
    Can you add some concrete examples? I don't see how an automapper would understand how to resolve differences between xml and class structure. Why don't you keep the data weakly typed? And why are you loading into a dataset, and then creating class instances? Couldn't you simply use XmlSerializer or data contracts? Commented Jun 18, 2012 at 12:04
  • Maybe this can help you out: stackoverflow.com/questions/87621/… or this one: stackoverflow.com/questions/386155/… Commented Jun 18, 2012 at 12:04
  • I am not updating xml back. I just need to read the xml. And after reading the xml, I have to filter out the records based on some input. I felt, for filtering records dataset would be a better option. Please correct me if I am wrong. Commented Jun 26, 2012 at 8:35

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.