QTP v10 Learn Online - On Sale Today

13
Jan 12

QTP – Saving your test run data

You can’t actually modify the data permanently in the datatable associated with the test script during a test run but there are two approaches you can take in order to save the data into an external file that you can use later.  During “run-time” a copy of the datatable is created as the “run-time datatable” and anything you write to the datatable is actually stored in this “run-time table” which is actually another instance of the datatable saved with the Test Run.  This has its Pros and Cons depending on how you look at it.  Regardless of your view if you want to permanently save your test data then you basically have two choices:

  1. You can use the “DataTable.Export” method or “DataTable.ExportSheet” method to literally create a new .xls file of the workbook or specified worksheet, and have this new file saved in your file system (locally or on the network).  With this approach you can then use that datatable/spreadsheet however you want including importing it into the permanent datatable attached to the test script if you want.
    QTP Export Method for use with the DataTable
    QTP ExportSheet Method for use with the DataTable
  2. Also keep in mind that your Test Results Report will show you the data used and created during the test run.  You can view this in the “Data Table” in the test report itself.
    QTP Test Report showing the Run-Time Data Table
    You can then export that data into an external file too, from the report.  The steps are slightly different depending on the version of QTP you are using, but from QTP v11 you would simply select “File > Export to File…” and then select “Data Table” from the “Report type” drop-down list.  When you click the “Export” button you can then specify a new name and location for the data file (.xls).  This will export ALL the data in the datatable (all the worksheets will be exported this way).  Like the previous approach, you now have an external .xls file that you can now do whatever you want with it, including importing it back into the permanent datatable attached to the test script.

QTP Test Report Export option to save off the run-time data table


by Shawn | About the author: Shawn LoPorto brings 23 years of diverse technology and business experience with strong technical skills, leadership, problem-solving, planning, team development and project management skills. Shawn is a Vice President of QA & CM. See the Profile page on this website for more information.

Related Posts


Comments


Name (required)

Email (required)

Website

XHTML: You can use these tags: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>

Share your wisdom