TofuPilotTofuPilot

Boolean

Record boolean values with equality validation.

WiFi Enabled
True
x==True
Pass
Device Connected
False
x==True
Fail
Calibrated
False
x!=True
Pass

You can create a boolean measurement with measurements:

measurements:
  - name: Device Connected
    validators: 
      - operator: "=="
        expected_value: true

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

PropertyTypeRequiredDescription
keystringNoUnique identifier for the measurement within the phase
namestringYesDisplay name (1-100 characters)
unitstringNoMeasurement unit (max 50 characters)
descriptionstringNoDetailed 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:

PropertyTypeRequiredDescription
operatorstringYesComparison operator
expected_valuebooleanYesExpected boolean value

You can use the following operators for boolean measurements:

OperatorExpected ValueDescriptionExample
==BooleanValue must equal expectedexpected_value: true
!=BooleanValue must not equal expectedexpected_value: false

TofuPilot evaluates validators and sets the outcome to Pass if met, Fail if not, or Unset if no value provided.

Examples

Connection Verification

We will verify device connection is established:

phases:
  - name: Connection Test
    python:
      module: verify_connection
    measurements:
      - name: Device Connected
        description: Verify USB connection to device
        validators:
          - operator: "=="
            expected_value: true
def verify_connection(run, 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:

phases:
  - name: Error Check
    python:
      module: 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: true
def check_errors(run, 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?