# How to: Test services (Testing Center)

In the Testing Center, a model can be applied against a dataset to determine the calculated outputs for many records at same time. This is beneficial for use cases around regression testing, model simulation, and portfolio projection. The Testing Center takes a "testbed first" approach to empower users to better create, manage, and run testbeds.

To access this feature, after choosing a specific service from [Folder overview](/navigation/folder-overview.md), choose the ![](/files/fX44oVHKD9JTbNvnN8xf) Testing Center icon from the service sidebar.

## Terminology

The following terminology is used in the Testing Center:

* A *testbed* contains *test cases*.
  * Each test case contains the inputs the Spark service will receive during testing.
  * A testbed can be "versioned up" by adding test cases to an existing testbed.
* A *testbed result* contains the testbed and the calculated results for each test case.
  * A testbed can be run against a Spark service version. The *Source* of this testbed result is *Spark*.
  * If a testbed result is uploaded to Spark, the *Source* of this testbed result is *User Upload*.

## Create a new testbed

<figure><img src="/files/um3Dan6zgh7HaDzm4h01" alt=""><figcaption></figcaption></figure>

1. Enter the *Testing Center* screen for the target service.
2. Create a new testbed by clicking, **New Testbed**.
3. On the resulting modal, there is the option to upload a testbed or generate test cases.
   * Uploading a testbed is more useful when actual data needs to be used in the Testing Center.
   * The *Test Case Generator* automatically generates relevant test cases within the selected bounds for each parameter.
     * This can be done in a random fashion, primarily for regression testing.
     * Systematic generation can exhaustively generate all combinations for comprehensive testing.

### Upload a custom testbed

This option allows users to generate a blank Excel template with the input headers of the service. The data entered here will form the test cases that will be part of the uploaded testbed.

{% hint style="info" %}
The testbed template is laid out to make it easy to delete input fields that are not required. Please review the README tab.
{% endhint %}

<figure><img src="/files/Sn0peUmtTFf6dRbSbv8Q" alt=""><figcaption></figcaption></figure>

1. Click *Download an Excel template to get started*.
2. Another modal follows with the ability to select particular subservices ([How to: Work with subservices](/build-spark-services/subservices.md)) to test.

   <figure><img src="/files/LHKAF49KxIZroKu6EBVa" alt=""><figcaption></figcaption></figure>
3. Click **Download.** The resulting file will have the inputs/outputs from the selected subservices.

   <figure><img src="/files/3YtjXzEQkMJxv2WVfjck" alt=""><figcaption></figcaption></figure>
4. Open the template in Excel.
5. Add test cases to the Excel file, using the column headers for guidance:
   * Each row represents one test case.
   * If certain inputs are not required, the columns related to those inputs can be deleted.
   * For any blank fields, Spark will use the default value to process the calculation.
   * *Description* is a free-text field and can be used to identify a particular test case.
   * Remember to save the Excel file before uploading!
6. Note that it is also possible to use the Excel output from the [API Call History](/navigation/api-call-history.md) as a testbed!
7. Follow the steps from *Upload testbed*.

![](/files/e5J0hEE7FjFausrALhq6)

<figure><img src="/files/ExUoCaeiuzLtqCts9foN" alt=""><figcaption></figcaption></figure>

8. After importing the testbed, a summary screen will detail the testbed that was imported. On this screen, there is the option to provide a name and description.
   * If the testbed name and description are defined in the testbed template, it will be automatically populated on this screen!
   * If no name has been defined, a unique system-generated name will be assigned.
9. Upon selecting **Upload**, the testbed will be added to the top of the testbed dashboard.

#### ***Import using CSV***

![](/files/VDq3AvJclYNJDMjzCVJ4)

Testbeds can also be constructed without using Excel. Comma Separated Values (CSV) files may be preferable in certain use cases since data from other systems can be used directly in the Testing Center.

* The CSV file must contain headers in the first row. These should correspond to the names of inputs in the Spark service.
* *Description* is a free-text field that can be added to identify a particular test case.

#### Handle null values

To set an input as `null` i.e.   &#x20;

* For Excel testbed uploads, an empty cell will be considered as `null`.
* For CSV testbed uploads, an entry that is `,null,` will be considered as `null`.

To set a table to be empty, we recommend using the Expanded Tables functionality and populating empty rows.

Similar to the [Execute API](/spark-apis/execute-api.md), the treatment of `null` is different for single value and table inputs.

* For single value inputs, a `null`, is equivalent to clearing the cell in Excel and numerically equal to `0`.
* If a table is set to a singular `null`, then the default value will be used for that input.

### Generate random test cases

The *Test Case Generator* can generate a testbed of randomized test cases based on a subset of the inputs defined on a Spark service. This works best for services where:

* The service consists of single cell `Xinput`.
* Each input has a clearly defined bounded Data Validation (see [How to: Set data validations](/build-spark-services/set-data-validations.md)).

<figure><img src="/files/wwbI8rLrZOMkvrfiPBHs" alt=""><figcaption></figcaption></figure>

1. Click **Randomized Test Case Generation** and select the subservices ([How to: Work with subservices](/build-spark-services/subservices.md)) to test.
2. Define the initial parameters, including the number of test cases you'd like to generate.
3. Spark automatically identifies the range of values based on the Data Validation defined in Excel for the `Xinput`.
   * For categorical inputs where the input range is finite, a subset of the field values can be included in the test case generation.
   * For numerical inputs, there are options to define the minimum, maximum, and step size.
   * Fields that are dependent on other fields can be automatically generated with the correct dependency. For example, this enables the generation of city, state, and country combinations. Fields that are generated through dependent validation will be shown with a message saying `Field values are generated based upon the value(s) of: <dependent fields>`. Dynamic validations will only be picked up if the Data Validation has been defined using absolute references in Excel, e.g. `$A$1`.
   * If an `Xinput` is larger than 1 cell, then the default values will be used for every test case.
4. Click **Generate test cases.**
5. When the process is complete, a modal will appear to show a summary of the resulting testbed.

### Generate test cases systematically

*Systematic test case generation* is used when you want to have more control around the test case generation. This includes features to systematically cover domain of inputs and/or to include random input values as well.

<div><figure><img src="/files/i2rbXviFSBLEROiRCpoN" alt="A screenshot of a screen titled &#x22;Systematic test case generation&#x22;. The left panel is titled &#x22;Define your testbed&#x22; and has options for &#x22;Testbed name&#x22;, &#x22;Select Version&#x22; and &#x22;Testbed description (optional)&#x22;. The right panel is titled &#x22;Set the variation parameters for each input&#x22; and contains a table of inputs with columns: &#x22;Input name&#x22;, &#x22;Generation type&#x22;, and &#x22;No. of variations&#x22;. There is a blue box at the bottom with the text &#x22;Total test cases to be generated: 1&#x22;. Below that are two buttons, &#x22;Cancel&#x22; and &#x22;Generate test cases&#x22;."><figcaption></figcaption></figure> <figure><img src="/files/jGyxImfU2Gh8SGPsxMkp" alt=""><figcaption></figcaption></figure></div>

1. Click **Systematic test case generation**.

2. On the left-hand side, set the name of the testbed and the version of the service it should be run against. By default, on the *Testbed name* the testbed is the name of the service followed by the timestamp. A *Testbed description* is optional.

3. On the right-hand side is a table of all the inputs defined in the service. This will show the *Input name*, the *Input type*, the *Generation type*, and the *No. of variations* for the input based on the *Input type* and parameters specified.

4. The total number of test cases generated will be the product of the number of variations for each input. For instance, if you have `10` variations for `Age`, `2` for `Sex`, and `5` for `Term period`, then the number of test cases will be `10 x 2 x 5 = 100`.

5. Click on an input to open the Edit pane.

   <figure><img src="/files/Vjl3vXnAkvjbjWDziaMy" alt=""><figcaption></figcaption></figure>

6. For single-cell inputs, 4 input types are available: *List*, *Random list*, *Number range*, and *Random number range*. Initially, all inputs are set to the input type detected from the service's default values. For each input choose the appropriate *Generation type* and parameters.

   | Generation type                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                         | Details                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                     |
   | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
   | <p><em>List</em>: Generate test cases for all the listed options.<br><br><img src="/files/2OFcaydSDQrwzQJLEgMS" alt="A screenshot of a panel titled &#x22;Sex&#x22; with two input fields: a dropdown labeled &#x22;Generation Type&#x22; which is currently set to &#x22;List&#x22; and an unlabeled dropdown with two pill-shaped options: &#x22;Male&#x22; and &#x22;Female&#x22;. Each pill has a small button with an x in it. Bold text under the box says &#x22;No. of variations: 2&#x22;. There are two buttons, one says Cancel and the other says Apply."></p>                                                                               | <p></p><ul><li>If there is a <em>List</em> type data validation for this input in Excel, those values will be shown as the starting list. Otherwise, the default value will be the only initial item in the list.</li><li>To remove a variation, click the <code>x</code> button.</li><li>To add new variations, click into the input box and begin typing. Hit <strong>Enter</strong> to create an option.</li><li>The number of variations is the same as the number of options.</li></ul>                                                                                                                                                                                                                                                                                                                                                                |
   | <p><em>Random list</em>: Systematically generate test cases from a randomly selected number of items in the listed options.<br><br> <img src="/files/Vp9GcIczv0V65au4UYen" alt="A screenshot of a panel titled &#x22;Sex&#x22; with two input fields: a dropdown labeled &#x22;Generation Type&#x22; which is currently set to &#x22;List&#x22; and an unlabeled dropdown with two pill-shaped options: &#x22;Male&#x22; and &#x22;Female&#x22;. Each pill has a small button with an x in it. Bold text under the box says &#x22;No. of variations: 2&#x22;. There are two buttons, one says Cancel and the other says Apply."></p>                    | <ul><li>If there is a <em>List</em> type data validation for this input in Excel, those values will be shown as the starting list. Otherwise, the default value will be the only initial item in the list.</li><li><p>The test cases will systematically step through a randomly predetermined list of the items until the desired number of variations has been reached.</p><ul><li>If there are more options than the desired number of variations, not every item will be used.</li><li>If there are fewer options than the desired number of variations, some items will be repeated</li></ul></li><li>To remove a variation, click the <code>x</code> button.</li><li>To add new variations, click into the input box and begin typing. Hit <strong>Enter</strong> to create an option.</li><li>You can now select the number of variations.</li></ul> |
   | <p><em>Number range</em>: Generate test cases to cover all the defined steps within a range.<br><br><img src="/files/cD0TWycbL1gWzEss2ozV" alt="A screenshot of a panel titled &#x22;Age&#x22; with 4 input fields: a dropdown labeled &#x22;Generation Type&#x22; which is currently set to &#x22;Range&#x22;, a textbox labeld &#x22;Min&#x22; with a value of 20, a textbox labeled &#x22;Max&#x22; with a value of 65, and a textbox labeled &#x22;Step size&#x22; with a value of 5. Bold text under the boxes says &#x22;No. of variations: 10&#x22;. There are two buttons, one says Cancel and the other says Apply."></p>                      | <ul><li>The <em>Number range</em> input type works similarly to "For loops" in many programming languages. Conceptually, think of skip counting in grade school: start at the value for <code>min</code> and skip count by the <code>step size</code> until arriving at the <code>max</code> (or the next number will be greater than the <code>max</code>).</li><li><p>Example: <code>min: 0</code>, <code>max: 20</code>, <code>step size: 5</code>.</p><ul><li>The sequence would be <code>0, 5, 10, 15, 20</code> , producing <code>5</code> variations.</li><li>If the <code>max</code> was <code>23</code>, the sequence would still stop at <code>20</code> because the next number <code>25</code> exceeds the <code>max</code>.</li></ul></li></ul>                                                                                                |
   | <p><em>Random number range</em>: Generate test cases selected randomly from all the defined steps within a range.<br><br><img src="/files/bKgKcCqu5XWKoLvctX0f" alt="A screenshot of a panel titled &#x22;Age&#x22; with 4 input fields: a dropdown labeled &#x22;Generation Type&#x22; which is currently set to &#x22;Range&#x22;, a textbox labeld &#x22;Min&#x22; with a value of 20, a textbox labeled &#x22;Max&#x22; with a value of 65, and a textbox labeled &#x22;Step size&#x22; with a value of 5. Bold text under the boxes says &#x22;No. of variations: 10&#x22;. There are two buttons, one says Cancel and the other says Apply."></p> | <ul><li>This functions the same as <em>Number range</em> but instead selects the desired number of items from the total number range list and iterates through it to create its variations.</li><li>Same as <em>Random list</em>, the test cases will systematically step through the same list of randomly selected items until the desired number of variations has been reached. If there are more options than the desired number of variations, not every item will be used. If there are fewer options than the desired number of variations, some items will be repeated.</li></ul>                                                                                                                                                                                                                                                                  |
   | *Static table*: For multi-cell range inputs.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            | <ul><li>For multi-cell range inputs, the only input type available is <em>Table</em>. This works similarly to the <em>List</em> input type for single-cell inputs, except that the value is the JSON-formatted string representing the table.</li><li>This table will be repeated for every record. In the future we may look to accommodate the systematic creation of table inputs.</li></ul>                                                                                                                                                                                                                                                                                                                                                                                                                                                             |

7. Click **Generate test cases.**

8. When the process is complete, a modal will show a summary of the resulting testbed.

{% hint style="info" %}
**NOTE:** Aside from the number of test cases, there are several other differences between systematic and randomized test case generation:

* Data validation in the Excel file is ignored except for the populating the initial set of options for the *List* and *Range* validation types. This is to support the creation of test cases that are intended to fail validation.&#x20;
* Complex or Dynamic dependencies such as varying the `Age` range parameters based on the `Sex` input field are only partially supported and will be randomly selected.
  {% endhint %}

## Manage testbeds

<figure><img src="/files/aoHRYbavIuoRY0egzZaO" alt=""><figcaption></figcaption></figure>

The *Testing Center* screen will list all of the testbeds that were created against the particular service. This screen includes the functionality to delete, download, favorite, run, and search testbeds.

## Run testbed

Once a testbed has successfully been created it can be run against a particular service version.

1. Navigate to a testbed and select the ‘run test’ icon (see image, above) on the right-hand side.

   ![](/files/Pela6hhwOlfARkj3APe4)
2. A modal will appear to allow the selection of the service version and service type.

   <figure><img src="/files/ACAsWSDoq7hoamSBiMTI" alt=""><figcaption></figcaption></figure>

   * By default, the latest service version will be selected.
   * The default service type used for new Spark services is [Neuron](/build-spark-services/neuron.md).
3. A unique, system-generated name for the testbed result will be assigned automatically. This name can be modified.
4. An optional description can be added to the Testbed.
5. Select **Run testbed** to initiate the run.
6. The modal can be closed if other tasks need to be performed in Spark.

   ![](/files/uoa1fvTBWiasrmK8eknC)

Upon completion of the test run, the results summary will appear. The results summary is also displayed in *Testbed details*. Testbed results can be downloaded in Excel or CSV format. CSV export is much faster for large testbed results.

{% hint style="warning" %}
If you encounter an error relating to timeout and batch size, we suggest the following actions:

* Adjusting in the [Service Documentation](/navigation/service-documentation.md) [Service Documentation](/navigation/service-documentation.md#service-details) change *Batch Size Override* to a lower number. This reduces the number of testbed records that are submitted at a time which reduces the likelihood of a timeout as fewer records will be processed together. The default batch size value is `100`.
* If you frequently encounter this across many Spark services, the batch size value can be adjusted for all services. This can be done by contacting [Support](/support/support.md).
  {% endhint %}

## Review testbed details

<figure><img src="/files/CY4HDsMGwcpaC4vVRY0V" alt=""><figcaption></figcaption></figure>

The *Testbed details* page is a drill-down section of a testbed. It is a consolidated space that is divided into two sections:

* The heading section, which contains additional details about the testbed, and&#x20;
* The testbed results section, which shows all of the testbed results associated with the testbed. This can include testbed results that are from a Spark testbed run or testbed results uploaded into Spark.

### Add test cases

Testbeds can be "versioned up" by appending additional test cases to an existing testbed.

![](/files/yTJZfRIMInPe2zeC25ZY)

<figure><img src="/files/fPA6FGEVg6QhNtY45Ji2" alt=""><figcaption></figcaption></figure>

1. From the Testbed details page heading section, select **Add test cases**.
2. Similar to [#import-a-custom-testbed](#import-a-custom-testbed "mention"):
   1. Download the testbed template.
   2. Add any new test cases to this file.
   3. Follow the steps from [#add-test-cases](#add-test-cases "mention").

![](/files/gpvcsAjff0DU8MpMduHE)

If the test cases were successfully loaded, the summary screen will show the new version of the testbed and the number of test cases appended.

{% hint style="info" %}
If the imported testbed contains test cases that already exist in the testbed, they will be removed and noted in the duplicated test case count.

If the uploaded additional test cases contain duplicates, those will not be removed.

If it is a requirement for the new test cases to contain duplicated test cases, modify the service to include a dummy input value that can serve as a unique index.
{% endhint %}

### Upload testbed results

The Testing Center also supports the ability to upload external testbed results for comparison. This is useful for comparing results from Spark with those from an externally generated process or system to identify intended and unintended mismatches.

![](/files/tzoVkNFgprF4mvUGrX3Y)

1. From the Testbed details testbed results section, select *Upload testbed results*.
2. Similar to [#import-a-custom-testbed](#import-a-custom-testbed "mention"):
   1. Download the testbed results template.
   2. Unlike before, only add the testbed results into the output columns.
      * Do not alter the existing test cases, as this will lead to an error.
      * The outputs do not all have to be populated for every row and/or column.
3. Follow the instructions on the *Upload testbed results* screen.
4. The testbed results will appear in the testbed results with the source as *User Upload*.

### **Explore a test case in API tester**

It is also possible to view the inputs for a particular test case in the [API Tester](/navigation/api-tester.md). This can be used to verify the calculations for the particular use case and to enable downloading the test case into an Excel file.

<figure><img src="/files/B5qT07o4Rph5F1TYlLai" alt=""><figcaption></figcaption></figure>

1. Navigate to Testing Center and open an existing testbed.
2. Under the *Testbed results* section, click or tap the "three-dot" menu on the right-hand side and select *Download as* > *Excel file*. This file contains all of the test cases and their associated UUIDs – you’ll need this for the next step.
3. Click the kebab menu again and select **Explore test case in API tester.**
4. When prompted, enter the UUID for the test case you are interested in examining and click **Submit.**

<figure><img src="/files/TAwhIEw9ijfJIlGJsEPt" alt=""><figcaption></figcaption></figure>

5. The [API Tester](/navigation/api-tester.md) should appear with the data from the test case. The API response can be downloaded for further investigation.

### **Compare testbed results**

The *Compare results* feature allows any two sets of testbed results to be compared, whether they are created by *Spark* or *User Uploaded*. Comparing results will quickly identify mismatches between two testbed results.

![](/files/YJ2p7fHICAgRIQ7lwCIP)

1. Select two testbed results.
2. Once selected, the **Compare results** button will change color to indicate it is available.
3. Click **Compare results**. A modal will appear when the comparison is initiated. Once complete, users will be presented with a summary screen of the comparison, including the number of *Testbed results compared*, *% Match*, *Mismatch errors* and *Run time*.
4. Download the results to see the detailed breakdown of the comparison in Excel. The resulting file includes color coding to identify differences in testbed results, by test case.

![](/files/luJytmDXRxoE9zYasTYB)


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.coherent.global/build-spark-services/how-to-test-services-testing-center.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
