Working with data tables

This topic describes how to create, populate, and update data tables.

Create a data table

The section describes how to create a data table with several data sets.

To create a data table, use the following API:

POST .../api/shared_spaces/<space_id>/workspaces/<workspace_id>/test_data_tables

The following table describes the payload for the API:

Argument Description
name The name of the data table.
data

The json object that contains the data.

  • parameters: An array of parameter names.
  • data_sets: An array of json objects with the data sets to create inside the data table.

    • name: The name of the data set.
    • iterations: An array of objects with values for the parameters, by parameter name.

The following guidelines apply:

  • The data sets will only hold values for parameters that appear in the parameter's property.
  • If the parameter's property is not provided, if it is empty, or if it contains names other than the ones used in the data sets, the values of the undeclared parameters in the data sets will be empty.

Sample data sets

{
    "data": [
        {
            "name": "graphics",
            "data": {
                "parameters": [
                    "color",
                    "shape",
                    "size"
                ],
                "data_sets": [
                    {
                        "name": "primary",
                        "iterations": [
                            {
                                "color": "red",
                                "shape": "circle",
                                "size": "small"
                            },
                            {
                                "color": "blue",
                                "shape": "rectangle",
                                "size": "medium"
                            }
                        ]
                    },           
                    {
                        "name": "secondary",
                        "iterations": [
                            {
                                "color": "green",
                                "shape": "triangle",
                                "size": "large"
                            },
                            {
                                "color": "yellow",
                                "shape": "hexagon",
                                "size": "small"
                            }
                        ]
                    }
                ]
          }
    ]
}

Back to top

Assign a data table to a test

The section describes how to assign a data table to a test.

To assign a data table, use the following API:

PUT …/api/shared_spaces/<space_id>/workspaces/<workspace_id>/tests/<test_id>

The following table describes the payload for the API:

Argument Description
id The test ID.
test_data_table

The data table reference.

  • type: The string “test_data_table”.
  • id: The data table ID.

Back to top

Update a data table

The section describes how to update an existing data table.

To update a data table, use the following API:

PUT .../api/shared_spaces/<space_id>/workspaces/<workspace_id>/test_data_tables/<data_table_id>

The following table describes the payload for the API:

Argument Description
id The ID of the data table.
data

The json object that contains the data.

  • parameters: An array of parameter names. This replaces existing parameters.
  • data_sets: An array of json objects. This updates or replaces existing data sets. Existing data sets for which values are not provided, are deleted.

    • id: (optional) If provided and the ID corresponds to an existing data set in the data table, it updates that data set. If not provided, it creates a new data set.
    • name: The name of the data set.
    • iterations: An array of objects with values for the parameters, by parameter name.

Back to top

See also: