When to Use Bulk Recording
While individual API calls work well for small sets of data, you should switch to the bulk endpoint when:
High Volume: Your test report contains more than 25 individual test runs.
Custom Frameworks: You are integrating a third-party tool (like Jenkins, PyTest, or a custom internal framework) that generates a unified report at the end of a run.
Network Optimization: You want to minimize the overhead of multiple HTTP handshakes.
Technical Implementation
Method: POST /Services/v7_0/RestService.svc/test-runs/record-multiple
Documentation: Spira v7 REST API Docs
Example Request (JSON)
The body of the request is an array of RemoteAutomatedTestRun objects:
[
{
"TestCaseId": 123,
"ReleaseId": 45,
"TestSetId": 678,
"ExecutionStatusId": 2,
"StartDate": "/Date(1715688000000-0000)/",
"EndDate": "/Date(1715688600000-0000)/",
"RunnerName": "PyTest-Framework",
"RunnerTestName": "LoginValidation",
"RunnerMessage": "Test passed successfully.",
"RunnerStackTrace": null
},
{
"TestCaseId": 124,
"ReleaseId": 45,
"TestSetId": 678,
"ExecutionStatusId": 1,
"StartDate": "/Date(1715688650000-0000)/",
"EndDate": "/Date(1715688700000-0000)/",
"RunnerName": "PyTest-Framework",
"RunnerTestName": "DataEntryValidation",
"RunnerMessage": "Assertion failed at line 42",
"RunnerStackTrace": "Traceback (most recent call last)..."
}
]
Crucial Step: Updating Summary Data
To maintain high performance during the data upload, Spira does not automatically recalculate the summary status of parent artifacts (Releases, Test Sets, Requirements, and Test Cases) in real-time when using the bulk endpoint.
Requirements for Reporting: After performing a bulk upload, the execution status of the parent artifacts will not reflect the new data until the Data Tools are executed.
Navigate to Administration > System > Data Tools.
Locate the tools for Recalculating Test Set/Case/Requirement/Release Statuses.
Performance Note: Running these tools can be resource-intensive on large databases. We recommend scheduling these operations as a nightly maintenance task rather than running them immediately after every upload to avoid impacting active users during business hours.
Best Practices
Batch Sizing: While there is no hard limit, we recommend batches of 100–500 runs per call for the best balance of speed and reliability.
Authentication: Ensure your API user has the necessary permissions to "Create Test Runs" in the target project.
Error Handling: Check the response code for the entire batch. If one object in the array is malformed, the entire request may fail.
Related Resources