Save test run values into DataTable Permanently

  • Questions
  • Save test run values into DataTable Permanently
Question ID: 105627
0
0

We all know that any test run values added to DataTable (i.e. DataTable.Value("xyz") = 1) are volatile and can only be retrieved in the test report.

I need to be able to set run time values in to the test DataTable Permanently so after the test the values are saved with in the test itself.

Marked as spam
Posted by (Questions: 17, Answers: 5)
Asked on October 22, 2014 6:34 pm
5 views
Answers (1)
0
Private answer

There is no way to directly update Datatable at runtime and have it retain. The only thing would be to use the datatable import and export function during run time to capture runtime data. There are two options that a user can use to access the runtime data table of a test.

Option 1:
After running the first test, the runtime data table is saved in the Default.xls file located in the results folder. You can specify the location of the result folder at the beginning of the test run. To access the runtime data table of the first test, insert the following line near the beginning of the second test:

DataTable.Import(''Default.xls'')

Option 2:
Instead of accessing the Default.xls file located in the results folder of the first test, you can export the runtime data table to its own location. At the end of the first test insert the following line:

DataTable.Export('''')

You can then access this same runtime data table from a second test by inserting the following line at the beginning of the second test:

DataTable.Import('''')

Example:
In the first test, insert the line below at the end of the test:

DataTable.Export(''C:myExcelFile.xls'')
This will save the runtime data table as myExcelFile.xls, at the root of the C: drive.

In the second test, insert the line below at the beginning of the test:

DataTable.Import(''C:myExcelFile.xls'')

This will import the existing .xls file into the second test.

Marked as spam
Posted by (Questions: 2, Answers: 98)
Answered on October 22, 2014 6:35 pm