Boolean
Last updated on October 28, 2026
Boolean Measurement: Device Connected
Value: false
Validator: x == true
Outcome: FAIL (false != true)You can create a boolean measurement with measurements:
measurements:
- name: Device Connected
validators:
- operator: "=="
expected_value: trueYou can set the measurement value in your Python phase:
def check_connection(run, measurements, device):
connected = device.is_connected()
measurements.device_connected = connected Definition
You can configure the measurement name and metadata.
| Property | Type | Required | Description |
|---|---|---|---|
key | string | No | Unique identifier for the measurement within the phase |
name | string | Yes | Display name (1-100 characters) |
unit | string | No | Measurement unit (max 50 characters) |
description | string | No | Detailed description (max 50,000 characters) |
TofuPilot auto-generates the key from name (snake_case) if not specified, and uses it for Python access (e.g., measurements.device_connected). The unit and description display in the web interface and reports.
Validators
You can add one or several validators to your measurement using the following properties:
| Property | Type | Required | Description |
|---|---|---|---|
operator | string | Yes | Comparison operator |
expected_value | boolean | Yes | Expected boolean value |
You can use the following operators for boolean measurements:
| Operator | Expected Value | Description | Example |
|---|---|---|---|
== | Boolean | Value must equal expected | expected_value: true |
!= | Boolean | Value must not equal expected | expected_value: false |
TofuPilot evaluates validators and sets the outcome to PASS if met, FAIL if not, or if no value was provided, and PASS if there are no validators, as in OpenHTF. See Outcome.
Examples
Connection Verification
We will verify device connection is established:
name: Board Bring-Up
plugs:
- key: device
name: Device
python: plugs.device:Device
main:
- name: Connection Test
python: phases.verify_connection
measurements:
- name: Device Connected
description: Verify USB connection to device
validators:
- operator: "=="
expected_value: truedef verify_connection(log, measurements, device):
log.info("Checking device connection")
connected = device.is_connected()
measurements.device_connected = connected
if not connected:
log.error("Device not connected")Multiple Boolean Checks
We will check multiple device states in one phase:
name: Firmware Validation
plugs:
- key: device
name: Device
python: plugs.device:Device
main:
- name: Error Check
python: phases.check_errors
measurements:
- name: Error State Active
description: Check if device is reporting errors
validators:
- operator: "!="
expected_value: true
- name: System Ready
description: Check if device is ready for testing
validators:
- operator: "=="
expected_value: truedef check_errors(log, measurements, device):
log.info("Checking device error state")
error_active = device.has_errors()
measurements.error_state_active = error_active
if error_active:
log.error("Device reporting errors")
ready = device.is_ready()
measurements.system_ready = ready
if not ready:
log.warning("Device not ready")How is this guide?