Create test run
Create a new test run that links to a procedure and either links to an existing unit or automatically creates one. Optionally include metadata, phases, measurements, and logs to capture comprehensive test execution data.
Access
API Key | Access Level | Description |
---|---|---|
User | Full | Users can create runs for any procedure of their organization |
Station | Limited | Stations can only create runs for procedures they were previously linked to from the app |
Endpoint
In: header
Array of sub-units that are part of this main unit. Each sub-unit must already exist and will be automatically linked as a sub-component of the main unit under test. If no sub-units are specified, the unit will be created without sub-unit relationships.
Overall test result indicating whether the test passed or failed. Use true when test succeeds, false when test fails.
Unique identifier of the procedure for the current run. The procedure needs to be created manually before in the app. The run will be linked to the procedure at creation.
Specific version of the test procedure used for the run. The procedure version will be automatically created if not found, or run will be linked to an existing one. If no procedure version is specified, the run will not be linked to any specific version.
ISO 8601 timestamp when the test run began execution. This timestamp will be used to track when the test execution started and for historical analysis of test runs. A separate created_at timestamp is stored internally server side to track upload date.
date-time
Test execution duration in ISO 8601 format. Combined with started_at to calculate the end time of the test execution. If not provided, defaults to zero duration.
"PT0S"
duration
Array of log messages generated during the test execution. Each log entry captures events, errors, and diagnostic information with severity levels and source code references. Logs will be automatically created and linked to the run. If no logs are specified, the run will be created without log entries.
Array of test phases with measurements and results. Each phase represents a distinct stage of the test execution with timing information, outcome status, and optional measurements. Phases will be automatically created and linked to the run. If no phases are specified, the run will be created without phase-level organization of test data.
The steps
field is deprecated in favor of phases
and measurements
, which provide more detailed test logging. Existing steps
will be auto-converted into a phase
, with a measurement
if they include a numeric value.
The procedure_name
field is deprecated and will be ignored. You can safely remove it from your scripts.
Response Body
from tofupilot import TofuPilotClient
client = TofuPilotClient()
result = client.create_run(
run_passed=true,
procedure_id="FVT1"
)
print(result)
{
"id": "497f6eca-6276-4993-bfeb-53cbbbba6f08"
}
{
"code": "BAD_REQUEST",
"message": "Part number is required but not provided and no automatic parsing is configured. Provide a part_number parameter or configure serial number parsing in organization settings.",
"issues": []
}
{
"code": "NOT_FOUND",
"message": "Procedure with ID {procedureId} does not exist. Create the procedure first in the app.",
"issues": []
}
{
"code": "UNPROCESSABLE_CONTENT",
"message": "Part number extraction failed for serial number {serialNumber}. Provide a part_number parameter explicitly or fix the regex pattern in organization settings.",
"issues": []
}
{
"code": "INTERNAL_SERVER_ERROR",
"message": "Internal server error",
"issues": []
}
How is this guide?