locked
test case RRS feed

  • Question

  • I have a function which takes xml as input ,Process the xml and insert the data to database.

    How to write a test case for this function? as there will be no written value.

    Regards,
    Venkatesh
    Thursday, June 23, 2005 1:24 PM

Answers

  • You can certainly take advantage of the code generation feature in VSTS. In your case there's no return value in the function to be tested. Therefore in the generated test you will need to add your own verification. For example, in order to verify whether values have been correctly inserted into the database, you can compare the expected value with the actual return value by querying the database.
    Friday, June 24, 2005 4:42 PM

All replies

  • It really depends on how you want to approach this issue, whether from a singular test case per scenario perspective or a data driven test.  To get started I would create an EDT test, and have the object created which contains the function in the constructor of the test.  Then I would create test functions (there should be one already created for you, and I usually just copy, paste, and rename them) and place your scenario XML in those and call the function.
    Thursday, June 23, 2005 4:12 PM
  • You can certainly take advantage of the code generation feature in VSTS. In your case there's no return value in the function to be tested. Therefore in the generated test you will need to add your own verification. For example, in order to verify whether values have been correctly inserted into the database, you can compare the expected value with the actual return value by querying the database.
    Friday, June 24, 2005 4:42 PM