Importing a data table (.csv file)

OneTest Embedded Component Testing for C and C++ provide the ability to import .csv table files and to turn these into standard .h header files. The resulting header file uses the same filename with a .h extension. Once included in your .ptu or .otd test script, this data can be used by the test driver script or the application under test.

Such .csv files can be produced by most spreadsheet programs or a text editor.

To import a .csv file into a test node:

  1. From the Project Explorer, right click an existing test node.

  2. From the pop-up menu, select Add File...

  3. Locate and select the .csv file and click OK.

  4. By default, added files are excluded from the build. Click the Excluded marker to allow the file to be built. The .csv table file must be located before the .ptu test script in the test node.

  5. Edit the .ptu test script to manually add an include statement of the resulting .h header file.

Note   The .csv data table file must be located before the .ptu test script in the test node. If not, then you must manually build the .csv data table file before building the test node.

CSV File Format

The formatting rules for the .csv file are as follow:

When the test node is built, OneTest Embedded produces a <filename>.h header file, where <filename> is based on the name of the input <filename>.csv file.

Use the arrays produced by the .csv file by including <filename>.h into your test script or source code.

The separator options for the .csv file are defined in two locations:

Example

This is an example of a valid table.csv data table:

var_A;var_B;var_C

int;signed int;float

12;34;45.2345

14;2;3.142

;-5;0

 

This produces the following corresponding table.h file:

int var_A[]={12,14};

signed int var_B[]={34,2,-5};

float var_C[]={45.2345,3.142,0};

 

Related Topics

General SettingsData table preferences