Skip to content

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: SiftClient

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 list_. If more than one test report is found,

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: SiftClient

grpc_client

TYPE: GrpcClient

rest_client

TYPE: RestClient

client property

client: SiftClient

grpc_client property

grpc_client: GrpcClient

rest_client property

rest_client: RestClient

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: str | TestReport

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: TestReportCreate | dict

log_file

If set, log the request to this file and return a simulated response.

TYPE: str | Path | None DEFAULT: None

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: TestMeasurementCreate | dict

update_step

Whether to update the step to failed if the measurement is being created is failed.

TYPE: bool DEFAULT: False

log_file

If set, log the request to this file and return a simulated response.

TYPE: str | Path | None DEFAULT: None

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: list[TestMeasurementCreate]

log_file

If set, log the request to this file and return a simulated response.

TYPE: str | Path | None DEFAULT: None

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: TestStepCreate | dict

log_file

If set, log the request to this file and return a simulated response.

TYPE: str | Path | None DEFAULT: None

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: str | TestReport

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: str | TestMeasurement

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: str | TestStep

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 list_.

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: str

RETURNS DESCRIPTION
TestReport

The TestReport.

get_step async

get_step(test_step: str | TestStep) -> TestStep

Get a TestStep.

PARAMETER DESCRIPTION
test_step

The TestStep or test step ID to get.

TYPE: str | TestStep

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: str | Path

RETURNS DESCRIPTION
TestReport

The imported TestReport.

import_log_file async

import_log_file(
    log_file: str | Path, incremental: bool = False
) -> ReplayResult

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: str | Path

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: bool DEFAULT: False

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: str | None DEFAULT: None

names

List of test report names to filter by.

TYPE: list[str] | None DEFAULT: None

name_contains

Partial name of the test report.

TYPE: str | None DEFAULT: None

name_regex

Regular expression string to filter test reports by name.

TYPE: str | Pattern | None DEFAULT: None

test_report_ids

Test report IDs to filter by.

TYPE: list[str] | None DEFAULT: None

status

Status to filter by (TestStatus enum).

TYPE: TestStatus | None DEFAULT: None

test_system_name

Test system name to filter by.

TYPE: str | None DEFAULT: None

test_case

Test case to filter by.

TYPE: str | None DEFAULT: None

serial_numbers

Serial numbers to filter by.

TYPE: list[str] | None DEFAULT: None

part_numbers

Part numbers to filter by.

TYPE: list[str] | None DEFAULT: None

system_operator

System operator to filter by.

TYPE: str | None DEFAULT: None

created_by

User ID who created the test report.

TYPE: str | None DEFAULT: None

modified_by

User ID who last modified the test report.

TYPE: str | None DEFAULT: None

created_after

Filter test reports created after this datetime.

TYPE: datetime | None DEFAULT: None

created_before

Filter test reports created before this datetime.

TYPE: datetime | None DEFAULT: None

modified_after

Filter test reports modified after this datetime.

TYPE: datetime | None DEFAULT: None

modified_before

Filter test reports modified before this datetime.

TYPE: datetime | None DEFAULT: None

metadata

Filter test reports by metadata criteria.

TYPE: list[Any] | dict[str, Any] | None DEFAULT: None

include_archived

Whether to include only archived or non-archived reports.

TYPE: bool DEFAULT: False

filter_query

Custom filter to apply to the test reports.

TYPE: str | None DEFAULT: None

order_by

How to order the retrieved test reports. If used, this will override the other filters.

TYPE: str | None DEFAULT: None

limit

How many test reports to retrieve. If None, retrieves all matches.

TYPE: int | None DEFAULT: None

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: list[str] | list[TestMeasurement] | None DEFAULT: None

test_steps

Test steps to filter by.

TYPE: list[str] | list[TestStep] | None DEFAULT: None

test_reports

Test reports to filter by.

TYPE: list[str] | list[TestReport] | None DEFAULT: None

name

Exact name of the test measurement.

TYPE: str | None DEFAULT: None

names

List of test measurement names to filter by.

TYPE: list[str] | None DEFAULT: None

name_contains

Partial name of the test measurement.

TYPE: str | None DEFAULT: None

name_regex

Regular expression string to filter test measurements by name.

TYPE: str | Pattern | None DEFAULT: None

measurement_type

Measurement type to filter by (TestMeasurementType enum).

TYPE: TestMeasurementType | None DEFAULT: None

passed

Whether the measurement passed.

TYPE: bool | None DEFAULT: None

filter_query

Explicit CEL query to filter test measurements.

TYPE: str | None DEFAULT: None

order_by

How to order the retrieved test measurements.

TYPE: str | None DEFAULT: None

limit

How many test measurements to retrieve. If None, retrieves all matches.

TYPE: int | None DEFAULT: None

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: list[str] | list[TestStep] | None DEFAULT: None

test_reports

Test reports to filter by.

TYPE: list[str] | list[TestReport] | None DEFAULT: None

parent_steps

Parent steps to filter by.

TYPE: list[str] | list[TestStep] | None DEFAULT: None

name

Exact name of the test step.

TYPE: str | None DEFAULT: None

names

List of test step names to filter by.

TYPE: list[str] | None DEFAULT: None

name_contains

Partial name of the test step.

TYPE: str | None DEFAULT: None

name_regex

Regular expression string to filter test steps by name.

TYPE: str | Pattern | None DEFAULT: None

status

Status to filter by (TestStatus enum).

TYPE: TestStatus | None DEFAULT: None

step_type

Step type to filter by (TestStepType enum).

TYPE: TestStepType | None DEFAULT: None

filter_query

Explicit CEL query to filter test steps.

TYPE: str | None DEFAULT: None

order_by

How to order the retrieved test steps.

TYPE: str | None DEFAULT: None

limit

How many test steps to retrieve. If None, retrieves all matches.

TYPE: int | None DEFAULT: None

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: str | TestReport

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: str | TestReport

update

Updates to apply to the TestReport.

TYPE: TestReportUpdate | dict

log_file

If set, log the request to this file and return a simulated response.

TYPE: str | Path | None DEFAULT: None

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: TestMeasurement

update

Updates to apply to the TestMeasurement.

TYPE: TestMeasurementUpdate | dict

update_step

Whether to update the step to failed if the measurement is being updated to failed.

TYPE: bool DEFAULT: False

log_file

If set, log the request to this file and return a simulated response.

TYPE: str | Path | None DEFAULT: None

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: str | TestStep

update

Updates to apply to the TestStep.

TYPE: TestStepUpdate | dict

log_file

If set, log the request to this file and return a simulated response.

TYPE: str | Path | None DEFAULT: None

RETURNS DESCRIPTION
TestStep

The updated TestStep.