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:
{
"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
ResultCreatepayload), sent after each test and forf3ts_assertsub-results
- A test case result (a
notif- A one-way user notification (a
Notifpayload)
- A one-way user notification (a
dialog- A two-way user dialog prompt (a
Dialogpayload) sent by theuser_dialogfixture
- A two-way user dialog prompt (a
banner- A status banner update (a
StatusBannerpayload)
- A status banner update (a
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 runtest_name: Name of the test case that was just calledmin_limit: Minimum limit settingmax_limit: Maximum limit settingmeas: The measurement value that was takenstart: The time that the test case was startedstop: The time that the test case was stoppedduration: The time that it took for the test case to be completedpassed: 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 titlemessage: Popup message contentokButtonText: Optional "OK" button textcancelButtonText: Optional "Cancel" button textinputType: 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 messagesokClicked: Clicked status of "OK" button on user dialogcancelClicked: 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")