Skip to content

Test Runner Control Features:

Below are commonly used features to help provide customizations to the Test Executer (TE) and GUI that are often used during test plan development.

Assertion Result Logging:

The pytest-f3ts fixture f3ts_assert can be used instead of a typical pytest assert call to run the assertion statement and send the assertion results directly to the Test Executer (TE) as a TestResult object.

Assert statements made with f3ts_assert will show up as sub results within the test application GUI and stored as a result in the results database.

Example - Multiple Assertions in a Single Test Case

python
def test_multiple_voltages(f3ts_assert):

    measurement = test_get_5V0()

    f3ts_assert(4.5 <= measurement <= 5.5,
                min_limit=4.5, meas=measurement, max_limit=5.5,
                error_msg="5V Outside of Limits")

    measurement = test_get_2V0()

    f3ts_assert(measurement <= 2.5,
                meas=measurement, max_limit=2.5,
                error_msg="2V Outside of Limits")

Custom Status Indicator:

The pytest-f3ts fixture status_banner can be used to override the status banner on the GUI to set any custom indicators during the test run.

This will override the default status indicators such as "Running" unless the override is removed.

Example - Operator Button Press Required

python
def test_button_press(status_banner, interface):

    # Set status banner to custom purple banner while
    # waiting for button press by test technician.
    status_banner.override(override=True,
                        status="Press Button to Continue",
                        color="#7E57C2")

    # Wait until button is pressed.
    while(interface.check_button());

    # Return status banner back to default.
    status_banner.override(override=False)

User Input/Dialog:

The pytest-f3ts fixture user_dialog can be used to send user dialog messages (Dialog) to the test_technician during a test run. These notifications can either wait for a user's response and return a DialogResponse object or continue with the test via use of the blocking parameter.

This will override the default status indicators such as "Running" unless the override is removed.

Example - OK/Cancel Dialog

python
from pytest_f3ts.schemas import Dialog, Notif

def test_user_msg(user_dialog):

    # Create message object to send to the frontend:
    message = Dialog(title="ACTION REQUIRED:",
                     message="Press 'yes' for pass, 'no' for fail",
                     okButtonText="yes",
                     cancelButtonText="no")

    # Blocking messages will wait for a response from the
    # frontend before proceeding:
    response = user_dialog.send(message, blocking=True)

    assert response.okClicked
    assert not response.cancelClicked

Example - Text Input Dialog

python
def test_user_msg_value(user_dialog):

    # Create message object to send to the frontend:
    message = Dialog(title="ACTION REQUIRED: ",
                     message="Enter '2' Below:",
                     inputType="text")

    # All messages will wait for a response by default
    # before proceeding:
    response = user_dialog.send(message)

    assert response.inputText == "2"
    assert int(response.inputText) == 2

Example - Notification Dialog

python
def test_user_msg(user_dialog):

    # Create message object to send to the frontend:
    message = Notif(title="WARNING: ",
                    message="No input required")

    # Non-blocking messages will not wait for a response from the
    # frontend before proceeding
    sent = user_dialog.send(message, blocking=False)

    assert sent == True