2

I am Microsoft .net developer. I have written an application which imports XML(which contain information about the employer, employee, dependent, benefit plans, cafeteria etc) files into my various SQL table (like employee, employer, plan, dependent tables etc)

now based on some business rules I am generating text output file.

This is the console application, it does not have any UI.

Now I want to create automation testing for this application to make sure that input and output data matches all business rules.

Note: in the output file, I have only selected nodes from the input file, not all the nodes from input files.

can someone please guide me how to do it? I haven't written any automation test earlier so please give your answer in detail.

4 Answers 4

1

So basically there are the following components in your system:

  • Importer that imports the data from XML to database
  • Database where you have a certain data schema
  • Exporter that accepts business rules

There are also some inputs:

  • XML file with user data
  • Business rules which are stored in some format as well

And the output:

  • Text file

Schema: enter image description here

Here you can automate tests for all the components and even data you have or automate the end-to-end flow.

Per-component automation:

  • Build a schema definition for your input xml (or get it from the dev guys). Each time you get new XML apply automated validation whether your input data corresponds to the expected data schema
  • Introduce a parser for your xml file. Using database connectivity for the programming language you know, make the checks of whether the proper values fall to the right places of your schema.
  • Depending on what the format of your "Business rules" is prepare some parser that would validate if your rules correspond to a certain grammar. You can do that for example with the help of regular expressions.
  • Now you can prepare some representative data that would be placed in your database and a set of test rules. Write a script that would deploy that data to your database and feed those rules to your app. Once you have the output you should compare that one to what you expect. Here is no any rocket science. You can just prepare the golden set for the output files and just match them with ones your application produces.

E-2-E automation:

  • You just have prepared inputs, rules and the golden-set for the outputs. Prepare the script that would execute your app with all the inputs which are in place. Then match the output vs your golden set.
1

Your simplest option is to "feed" the application a set of known XML files containing the range of data you want to test.

You confirm the output with a set of baseline output files that you already know are good, and compare each file with the corresponding generated output file.

For speed and simplicity, I'd do a whole-file comparison first, and only look at the line-by-line comparison if the two files differ.

0

One option would be to add an additional step to convert back to XML and then see if the output matches the original source

2
  • in the output file, I have only some selected nodes from XML file, not entire XML file in output. let me edit my question, sorry for confusion.
    – M005
    Apr 25, 2018 at 11:11
  • Could you use the entire XML? It might help. Apr 25, 2018 at 11:12
0

Another option is to use (or even write) a third party tool that does inquiries into both XML and SQL in a separate format (could be sql, xml or something else) to verify that the data from different sources and format matches.

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.