sift_client.resources.test_results
¶
| CLASS | DESCRIPTION |
|---|---|
TestResultsAPIAsync |
High-level API for interacting with test reports, steps, and measurements. |
TestResultsAPIAsync
¶
TestResultsAPIAsync(sift_client: SiftClient)
Bases: ResourceBase
High-level API for interacting with test reports, steps, and measurements.
Initialize the TestResultsAPI.
| PARAMETER | DESCRIPTION |
|---|---|
sift_client
|
The Sift client to use.
TYPE:
|
| METHOD | DESCRIPTION |
|---|---|
archive |
Archive a test report. |
create |
Create a new test report. |
create_measurement |
Create a new test measurement. |
create_measurements |
Create multiple test measurements in a single request. |
create_step |
Create a new test step. |
delete |
Delete a test report. |
delete_measurement |
Delete a test measurement. |
delete_step |
Delete a test step. |
find |
Find a single test report matching the given query. Takes the same arguments as |
get |
Get a TestReport. |
get_step |
Get a TestStep. |
import_ |
Import a test report from an already-uploaded file. |
import_log_file |
Replay a log file by parsing each entry, simulating the results, then creating for real. |
list_ |
List test reports with optional filtering. |
list_measurements |
List test measurements with optional filtering. |
list_steps |
List test steps with optional filtering. |
unarchive |
Unarchive a test report. |
update |
Update a TestReport. |
update_measurement |
Update a TestMeasurement. |
update_step |
Update a TestStep. |
| ATTRIBUTE | DESCRIPTION |
|---|---|
client |
TYPE:
|
grpc_client |
TYPE:
|
rest_client |
TYPE:
|
archive
async
¶
archive(*, test_report: str | TestReport) -> TestReport
Archive a test report.
| PARAMETER | DESCRIPTION |
|---|---|
test_report
|
The TestReport or test report ID to archive.
TYPE:
|
create
async
¶
create(
test_report: TestReportCreate | dict,
log_file: str | Path | None = None,
) -> TestReport
Create a new test report.
| PARAMETER | DESCRIPTION |
|---|---|
test_report
|
The test report to create (can be TestReport or TestReportCreate).
TYPE:
|
log_file
|
If set, log the request to this file and return a simulated response.
TYPE:
|
| RETURNS | DESCRIPTION |
|---|---|
TestReport
|
The created TestReport. |
create_measurement
async
¶
create_measurement(
test_measurement: TestMeasurementCreate | dict,
update_step: bool = False,
log_file: str | Path | None = None,
) -> TestMeasurement
Create a new test measurement.
| PARAMETER | DESCRIPTION |
|---|---|
test_measurement
|
The test measurement to create (can be TestMeasurement or TestMeasurementCreate).
TYPE:
|
update_step
|
Whether to update the step to failed if the measurement is being created is failed.
TYPE:
|
log_file
|
If set, log the request to this file and return a simulated response.
TYPE:
|
| RETURNS | DESCRIPTION |
|---|---|
TestMeasurement
|
The created TestMeasurement. |
create_measurements
async
¶
create_measurements(
test_measurements: list[TestMeasurementCreate],
log_file: str | Path | None = None,
) -> tuple[int, list[str]]
Create multiple test measurements in a single request.
| PARAMETER | DESCRIPTION |
|---|---|
test_measurements
|
The test measurements to create.
TYPE:
|
log_file
|
If set, log the request to this file and return a simulated response.
TYPE:
|
| RETURNS | DESCRIPTION |
|---|---|
tuple[int, list[str]]
|
A tuple of (measurements_created_count, measurement_ids). |
create_step
async
¶
create_step(
test_step: TestStepCreate | dict,
log_file: str | Path | None = None,
) -> TestStep
Create a new test step.
| PARAMETER | DESCRIPTION |
|---|---|
test_step
|
The test step to create (can be TestStep or TestStepCreate).
TYPE:
|
log_file
|
If set, log the request to this file and return a simulated response.
TYPE:
|
| RETURNS | DESCRIPTION |
|---|---|
TestStep
|
The created TestStep. |
delete
async
¶
delete(*, test_report: str | TestReport) -> None
Delete a test report.
| PARAMETER | DESCRIPTION |
|---|---|
test_report
|
The TestReport or test report ID to delete.
TYPE:
|
delete_measurement
async
¶
delete_measurement(
*, test_measurement: str | TestMeasurement
) -> None
Delete a test measurement.
| PARAMETER | DESCRIPTION |
|---|---|
test_measurement
|
The TestMeasurement or measurement ID to delete.
TYPE:
|
delete_step
async
¶
delete_step(*, test_step: str | TestStep) -> None
Delete a test step.
| PARAMETER | DESCRIPTION |
|---|---|
test_step
|
The TestStep or test step ID to delete.
TYPE:
|
find
async
¶
find(**kwargs) -> TestReport | None
Find a single test report matching the given query. Takes the same arguments as list_. If more than one test report is found,
raises an error.
| PARAMETER | DESCRIPTION |
|---|---|
**kwargs
|
Keyword arguments to pass to
DEFAULT:
|
| RETURNS | DESCRIPTION |
|---|---|
TestReport | None
|
The TestReport found or None. |
get
async
¶
get(*, test_report_id: str) -> TestReport
Get a TestReport.
| PARAMETER | DESCRIPTION |
|---|---|
test_report_id
|
The ID of the test report.
TYPE:
|
| RETURNS | DESCRIPTION |
|---|---|
TestReport
|
The TestReport. |
get_step
async
¶
Get a TestStep.
| PARAMETER | DESCRIPTION |
|---|---|
test_step
|
The TestStep or test step ID to get.
TYPE:
|
import_
async
¶
import_(test_file: str | Path) -> TestReport
Import a test report from an already-uploaded file.
| PARAMETER | DESCRIPTION |
|---|---|
test_file
|
The path to the test report file to import. We currently only support XML files exported from NI TestStand.
TYPE:
|
| RETURNS | DESCRIPTION |
|---|---|
TestReport
|
The imported TestReport. |
import_log_file
async
¶
Replay a log file by parsing each entry, simulating the results, then creating for real.
This method reads a log file created by the simulation logging, reconstructs all the objects via simulation, and then creates them via the actual API. IDs are mapped from simulated to real during the creation process.
| PARAMETER | DESCRIPTION |
|---|---|
log_file
|
Path to the log file to import.
TYPE:
|
incremental
|
(internal tooling) If True, goes line by line and calls API every event -- keeps track of last line sent so it can be called after some updates and be additive vs. replaying the entire log file each time(i.e. when False, reads the entire log file, building a test report in memory, then sends the calls for each step/measurement to the API).
TYPE:
|
| RETURNS | DESCRIPTION |
|---|---|
ReplayResult
|
A ReplayResult containing the created report, steps, and measurements. |
list_
async
¶
list_(
*,
name: str | None = None,
names: list[str] | None = None,
name_contains: str | None = None,
name_regex: str | Pattern | None = None,
test_report_ids: list[str] | None = None,
status: TestStatus | None = None,
test_system_name: str | None = None,
test_case: str | None = None,
serial_numbers: list[str] | None = None,
part_numbers: list[str] | None = None,
system_operator: str | None = None,
created_by: str | None = None,
modified_by: str | None = None,
created_after: datetime | None = None,
created_before: datetime | None = None,
modified_after: datetime | None = None,
modified_before: datetime | None = None,
metadata: list[Any] | dict[str, Any] | None = None,
include_archived: bool = False,
filter_query: str | None = None,
order_by: str | None = None,
limit: int | None = None,
) -> list[TestReport]
List test reports with optional filtering.
| PARAMETER | DESCRIPTION |
|---|---|
name
|
Exact name of the test report.
TYPE:
|
names
|
List of test report names to filter by.
TYPE:
|
name_contains
|
Partial name of the test report.
TYPE:
|
name_regex
|
Regular expression string to filter test reports by name.
TYPE:
|
test_report_ids
|
Test report IDs to filter by.
TYPE:
|
status
|
Status to filter by (TestStatus enum).
TYPE:
|
test_system_name
|
Test system name to filter by.
TYPE:
|
test_case
|
Test case to filter by.
TYPE:
|
serial_numbers
|
Serial numbers to filter by.
TYPE:
|
part_numbers
|
Part numbers to filter by.
TYPE:
|
system_operator
|
System operator to filter by.
TYPE:
|
created_by
|
User ID who created the test report.
TYPE:
|
modified_by
|
User ID who last modified the test report.
TYPE:
|
created_after
|
Filter test reports created after this datetime.
TYPE:
|
created_before
|
Filter test reports created before this datetime.
TYPE:
|
modified_after
|
Filter test reports modified after this datetime.
TYPE:
|
modified_before
|
Filter test reports modified before this datetime.
TYPE:
|
metadata
|
Filter test reports by metadata criteria.
TYPE:
|
include_archived
|
Whether to include only archived or non-archived reports.
TYPE:
|
filter_query
|
Custom filter to apply to the test reports.
TYPE:
|
order_by
|
How to order the retrieved test reports. If used, this will override the other filters.
TYPE:
|
limit
|
How many test reports to retrieve. If None, retrieves all matches.
TYPE:
|
| RETURNS | DESCRIPTION |
|---|---|
list[TestReport]
|
A list of TestReports that matches the filter. |
list_measurements
async
¶
list_measurements(
*,
measurements: list[str]
| list[TestMeasurement]
| None = None,
test_steps: list[str] | list[TestStep] | None = None,
test_reports: list[str]
| list[TestReport]
| None = None,
name: str | None = None,
names: list[str] | None = None,
name_contains: str | None = None,
name_regex: str | Pattern | None = None,
measurement_type: TestMeasurementType | None = None,
passed: bool | None = None,
filter_query: str | None = None,
order_by: str | None = None,
limit: int | None = None,
) -> list[TestMeasurement]
List test measurements with optional filtering.
| PARAMETER | DESCRIPTION |
|---|---|
measurements
|
Measurements to filter by.
TYPE:
|
test_steps
|
Test steps to filter by.
TYPE:
|
test_reports
|
Test reports to filter by.
TYPE:
|
name
|
Exact name of the test measurement.
TYPE:
|
names
|
List of test measurement names to filter by.
TYPE:
|
name_contains
|
Partial name of the test measurement.
TYPE:
|
name_regex
|
Regular expression string to filter test measurements by name.
TYPE:
|
measurement_type
|
Measurement type to filter by (TestMeasurementType enum).
TYPE:
|
passed
|
Whether the measurement passed.
TYPE:
|
filter_query
|
Explicit CEL query to filter test measurements.
TYPE:
|
order_by
|
How to order the retrieved test measurements.
TYPE:
|
limit
|
How many test measurements to retrieve. If None, retrieves all matches.
TYPE:
|
| RETURNS | DESCRIPTION |
|---|---|
list[TestMeasurement]
|
A list of TestMeasurements that matches the filter. |
list_steps
async
¶
list_steps(
*,
test_steps: list[str] | list[TestStep] | None = None,
test_reports: list[str]
| list[TestReport]
| None = None,
parent_steps: list[str] | list[TestStep] | None = None,
name: str | None = None,
names: list[str] | None = None,
name_contains: str | None = None,
name_regex: str | Pattern | None = None,
status: TestStatus | None = None,
step_type: TestStepType | None = None,
filter_query: str | None = None,
order_by: str | None = None,
limit: int | None = None,
) -> list[TestStep]
List test steps with optional filtering.
| PARAMETER | DESCRIPTION |
|---|---|
test_steps
|
Test steps to filter by.
TYPE:
|
test_reports
|
Test reports to filter by.
TYPE:
|
parent_steps
|
Parent steps to filter by.
TYPE:
|
name
|
Exact name of the test step.
TYPE:
|
names
|
List of test step names to filter by.
TYPE:
|
name_contains
|
Partial name of the test step.
TYPE:
|
name_regex
|
Regular expression string to filter test steps by name.
TYPE:
|
status
|
Status to filter by (TestStatus enum).
TYPE:
|
step_type
|
Step type to filter by (TestStepType enum).
TYPE:
|
filter_query
|
Explicit CEL query to filter test steps.
TYPE:
|
order_by
|
How to order the retrieved test steps.
TYPE:
|
limit
|
How many test steps to retrieve. If None, retrieves all matches.
TYPE:
|
| RETURNS | DESCRIPTION |
|---|---|
list[TestStep]
|
A list of TestSteps that matches the filter. |
unarchive
async
¶
unarchive(*, test_report: str | TestReport) -> TestReport
Unarchive a test report.
| PARAMETER | DESCRIPTION |
|---|---|
test_report
|
The TestReport or test report ID to unarchive.
TYPE:
|
update
async
¶
update(
test_report: str | TestReport,
update: TestReportUpdate | dict,
log_file: str | Path | None = None,
) -> TestReport
Update a TestReport.
| PARAMETER | DESCRIPTION |
|---|---|
test_report
|
The TestReport or test report ID to update.
TYPE:
|
update
|
Updates to apply to the TestReport.
TYPE:
|
log_file
|
If set, log the request to this file and return a simulated response.
TYPE:
|
| RETURNS | DESCRIPTION |
|---|---|
TestReport
|
The updated TestReport. |
update_measurement
async
¶
update_measurement(
test_measurement: TestMeasurement,
update: TestMeasurementUpdate | dict,
update_step: bool = False,
log_file: str | Path | None = None,
) -> TestMeasurement
Update a TestMeasurement.
| PARAMETER | DESCRIPTION |
|---|---|
test_measurement
|
The TestMeasurement or measurement ID to update.
TYPE:
|
update
|
Updates to apply to the TestMeasurement.
TYPE:
|
update_step
|
Whether to update the step to failed if the measurement is being updated to failed.
TYPE:
|
log_file
|
If set, log the request to this file and return a simulated response.
TYPE:
|
| RETURNS | DESCRIPTION |
|---|---|
TestMeasurement
|
The updated TestMeasurement. |
update_step
async
¶
update_step(
test_step: str | TestStep,
update: TestStepUpdate | dict,
log_file: str | Path | None = None,
) -> TestStep
Update a TestStep.
| PARAMETER | DESCRIPTION |
|---|---|
test_step
|
The TestStep or test step ID to update.
TYPE:
|
update
|
Updates to apply to the TestStep.
TYPE:
|
log_file
|
If set, log the request to this file and return a simulated response.
TYPE:
|
| RETURNS | DESCRIPTION |
|---|---|
TestStep
|
The updated TestStep. |