Skip to content

FixturFab Test Executor Communication

The FixturFab Test Executor utilizes uses a combination of websockets and HTTP requests to communicate with the test runner backend and frontend.

A sample communication diagram is shown below.

The User Interface (GUI) triggers the start of a test run by the test technician pressing Run. This sends an API command to the Test Executor (TE) which then starts the pytest thread.

As the pytest test plan (TP) is executed, messages are then sent to the TE. These messages are then logged to the results database as well as communicated to the GUI to be displayed to the test technician. Custom messages can be sent to the TE as part of the pytest test plan (TP) during the test to change status banners or send user dialog or user notifications during execution using custom pytest_f3ts pytest fixtures. View documentaiton on available fixtures using pytest --fixtures or under the references tab.

Message Structure

Websocket Messages

Websocket messages are sent as JSON objects with the following structure:

json
{
    "type": "message_type",
    "toClient": "{{received ID}}",
    "fromClient": "{{sender ID}}",
    "data": {
        "key": "value"
    }
}

The following types are specified:

  • connect
    • Sent by the backend to the frontend to initiate a connection handshake
  • result
    • A test case result (a ResultCreate payload), sent after each test and for f3ts_assert sub-results
  • notif
    • A one-way user notification (a Notif payload)
  • dialog
    • A two-way user dialog prompt (a Dialog payload) sent by the user_dialog fixture
  • banner
    • A status banner update (a StatusBanner payload)
  • serial
    • A device serial number update

Message Types

Test Results

This message is sent after every a test has been called via the pytest_runtest_logreport hook. This can also be sent manually for assertion statements via the f3ts_assert fixture. After the test has been completed, a TestResult object is created and sent over the api/run/{run_id}/result endpoint.

A TestResult contains the following information:

  • test_id: ID of the test that was just run
  • test_name: Name of the test case that was just called
  • min_limit: Minimum limit setting
  • max_limit: Maximum limit setting
  • meas: The measurement value that was taken
  • start: The time that the test case was started
  • stop: The time that the test case was stopped
  • duration: The time that it took for the test case to be completed
  • passed: Pass/Fail status for the test case

User Input

User dialog messages can be sent to the frontend via the user_dialog fixture. By passing a Dialog object to this fixture, a message will be sent is created and sent over websockets. If it is a blocking message, the user_dialog fixture will return a DialogResponse object once a user has interacted with the user dialog prompt.

A Dialog contains the following information:

  • title: Popup message title
  • message: Popup message content
  • okButtonText: Optional "OK" button text
  • cancelButtonText: Optional "Cancel" button text
  • inputType: Optional input type (supported types: "text")
  • defaultText: Default input text for "text" type messages

A DialogResponse contains the following information:

  • inputText: Input text entered by user on frontend for "text" type messages
  • okClicked: Clicked status of "OK" button on user dialog
  • cancelClicked: Clicked status of "Cancel" button on user dialog

Status Banner

Custom status banners can be sent to the frontend via the status_banner fixture. By passing a StatusBanner object to this fixture, a message will be sent is created and sent over websockets.

A StatusBanner contains the following information:

  • status: Status banner text (ex/ "Close Fixture", "Running")
  • color: Status banner color in hex colora code (ex/ "#7E57C2")