A Sample REST Request to POST Test Runs

The method you should use to record a test run is:

POST: projects/{project_id}/test-runs/record

So, if you Spira URL is: https://mycompany.spiraservice.net (for example), the API parameters to use would be:

A sample JSON payload  you can use for the request would be:

{
  "TestRunFormatId":2,
  "RunnerAssertCount":0,
  "StartDate":"2020-06-15T15:00:00.000",
  "EndDate":"2020-06-15T15:05:00.000",
  "RunnerName":"ExampleTestEngine",
  "RunnerTestName":"Executing Login Test post installation",
  "RunnerMessage":"Success",
  "RunnerStackTrace":"",
  "TestCaseId":123,
  "ReleaseId": 123,
  "TestSetId": 123,
  "ExecutionStatusId":2,
  "TestRunSteps": [
    {
      "TestStepId": 45,
      "ExecutionStatusId": 2,
      "Description": "info goes here",
      "ActualResult": "result goes here"
    }
  ],
  "CustomProperties": [
    {
      "PropertyNumber": 5,
      "IntegerValue": 29
    },
    {
      "PropertyNumber": 1,
      "IntegerListValue": [15]
    }
  ]
}

In this example we are posting the main Test Run body, plus the following collections:

  • List of Test Run Steps
    • Single test run step with an execution status and actual result.
  • List of Custom Property Values
    • Custom_01 = set to a value in a multi-list custom property
    • Custom_05 = set to a value in a single-list custom property

If you use this example, please change these IDs to match your project and instance:

  • TestCaseId
  • TestSetId [Optiona]
  • ReleaseId [Optional]
  • TestStepId [Optional]