Test Sequences

Complete guide to creating and managing test sequences in SeqMaster

Overview

Test sequences in SeqMaster are defined using YAML or JSON files. Each sequence consists of metadata, configuration, and a series of steps that are executed in order. Sequences can include measurements, actions, flow control, and operator interactions.

Key Concepts

  • Steps - Individual test operations (measure, action, prompt, etc.)
  • Groups - Logical grouping of related steps
  • Property Sets - External limit files for different product variants
  • Variables - Dynamic values that persist across steps
  • Flow Control - Conditional execution and loops

YAML Format

Sequences are typically written in YAML for readability. Here's the basic structure:

pcb_functional_test.yaml
name: PCB Functional Test
version: "1.0.0"
description: Complete functional test for PCB Rev A

metadata:
  author: John Smith
  created: "2024-01-15"
  part_number: PCB-001-A

config:
  timeout: 300  # seconds
  stop_on_fail: false
  property_set: pcb_rev_a_limits.yaml

steps:
  - id: init_dmm
    name: Initialize DMM
    type: setup
    driver: keysight_34461a
    config:
      mode: DC_VOLTAGE
      range: 10

  - id: measure_vcc
    name: Measure VCC
    type: measurement
    driver: keysight_34461a
    action: read
    limits:
      low: 4.8
      high: 5.2
      unit: V

Step Types

SeqMaster supports several step types for different operations:

setup

Initialize and configure hardware before measurements.

- id: setup_psu
  name: Configure Power Supply
  type: setup
  driver: rigol_dp832
  config:
    channel: 1
    voltage: 12.0
    current_limit: 1.0
    output: true

measurement

Take measurements and compare against limits.

- id: check_current
  name: Measure Quiescent Current
  type: measurement
  driver: keysight_34461a
  action: measure_current
  limits:
    low: 0.001
    high: 0.050
    unit: A
  store_as: quiescent_current  # Save to variable

action

Perform actions without measuring (toggle, send command, etc.).

- id: toggle_relay
  name: Connect Load
  type: action
  driver: test_fixture
  action: set_relay
  params:
    relay: K1
    state: true

prompt

Request operator input or verification.

- id: verify_led
  name: LED Verification
  type: prompt
  message: "Is the green LED blinking?"
  options:
    - label: "Yes"
      value: pass
    - label: "No"
      value: fail
  timeout: 30

script

Execute custom Python code for complex operations.

- id: custom_calc
  name: Calculate Efficiency
  type: script
  code: |
    input_power = vars['input_voltage'] * vars['input_current']
    output_power = vars['output_voltage'] * vars['output_current']
    efficiency = (output_power / input_power) * 100
    
    result.value = efficiency
    result.passed = efficiency >= 85
    result.message = f"Efficiency: {efficiency:.1f}%"

delay

Wait for a specified duration.

- id: stabilize
  name: Wait for Stabilization
  type: delay
  duration: 2.5  # seconds

Variables

Variables allow you to store and reuse values across steps. They can be defined at sequence start, captured from measurements, or set via scripts.

Using Variables
variables:
  board_type: "rev_a"
  test_voltage: 5.0
  max_retries: 3

steps:
  - id: measure_v
    name: Measure Voltage
    type: measurement
    driver: dmm
    action: read
    store_as: measured_voltage  # Store result
  
  - id: calc_error
    name: Calculate Error
    type: script
    code: |
      expected = vars['test_voltage']
      actual = vars['measured_voltage']
      error = abs(actual - expected) / expected * 100
      result.value = error
      result.passed = error < 5  # 5% tolerance
  
  - id: show_result
    name: Display Result
    type: prompt
    message: "Measured: ${measured_voltage}V"  # Variable interpolation

Flow Control

Control sequence execution with conditions, loops, and groups.

Conditional Execution

- id: extended_test
  name: Extended Burn-in
  type: group
  condition: "vars['board_type'] == 'military'"
  steps:
    - id: temp_cycle
      name: Temperature Cycling
      # ... steps only run for military boards

Loops

- id: channel_test
  name: Test All Channels
  type: group
  loop:
    variable: channel
    values: [1, 2, 3, 4]
  steps:
    - id: test_ch_${channel}
      name: Test Channel ${channel}
      type: measurement
      # ...

Retry on Failure

- id: flaky_test
  name: Communication Check
  type: measurement
  driver: serial_device
  retry:
    count: 3
    delay: 1.0  # seconds between retries
  # ...

Property Sets

Property sets allow you to externalize test limits and parameters. This enables using the same sequence for different product variants with different specifications.

pcb_rev_a_limits.yaml
name: PCB Rev A Limits
description: Standard limits

properties:
  vcc_min: 4.8
  vcc_max: 5.2
  current_max: 0.5
  temp_min: 0
  temp_max: 70
pcb_rev_b_limits.yaml
name: PCB Rev B Limits  
description: Extended range

properties:
  vcc_min: 4.5
  vcc_max: 5.5
  current_max: 0.8
  temp_min: -40
  temp_max: 85
Using Property Sets in Sequences
config:
  property_set: "${PROPERTY_SET}"  # Selected at runtime

steps:
  - id: check_vcc
    name: VCC Measurement
    type: measurement
    limits:
      low: "${props.vcc_min}"   # From property set
      high: "${props.vcc_max}"  # From property set
      unit: V

Complete Examples

complete_functional_test.yaml
name: Complete Functional Test
version: "2.1.0"
description: Full production test for Widget PCB

metadata:
  author: Test Engineering Team
  created: "2024-06-01"
  part_numbers:
    - PCB-WIDGET-001
    - PCB-WIDGET-002

config:
  timeout: 600
  stop_on_fail: false
  property_set: widget_limits.yaml
  required_hardware:
    - keysight_34461a
    - rigol_dp832
    - test_fixture

variables:
  test_mode: "production"

steps:
  # === SETUP PHASE ===
  - id: setup_group
    name: Hardware Setup
    type: group
    steps:
      - id: init_dmm
        name: Initialize DMM
        type: setup
        driver: keysight_34461a
        config:
          mode: DC_VOLTAGE
          range: AUTO
          
      - id: init_psu
        name: Configure Power Supply
        type: setup
        driver: rigol_dp832
        config:
          channel: 1
          voltage: 5.0
          current_limit: 1.0
          output: true
          
      - id: wait_power
        name: Wait for Power Stabilization
        type: delay
        duration: 1.0
  
  # === POWER MEASUREMENTS ===
  - id: power_tests
    name: Power Rail Tests
    type: group
    steps:
      - id: measure_vcc
        name: VCC Rail
        type: measurement
        driver: keysight_34461a
        action: measure_dc_voltage
        limits:
          low: "${props.vcc_min}"
          high: "${props.vcc_max}"
          unit: V
        store_as: vcc_measured
        
      - id: measure_3v3
        name: 3.3V Rail
        type: measurement
        driver: keysight_34461a
        action: measure_dc_voltage
        limits:
          low: 3.2
          high: 3.4
          unit: V
        store_as: v3v3_measured
        
  # === FUNCTIONAL TESTS ===
  - id: func_tests
    name: Functional Tests
    type: group
    steps:
      - id: comm_test
        name: Communication Test
        type: action
        driver: test_fixture
        action: send_command
        params:
          command: "*IDN?"
          expected: "WIDGET"
        retry:
          count: 3
          delay: 0.5
          
      - id: led_check
        name: LED Verification
        type: prompt
        message: "Verify green LED is blinking"
        options:
          - label: "Pass"
            value: pass
          - label: "Fail"
            value: fail
        timeout: 30
  
  # === CLEANUP ===
  - id: cleanup
    name: Test Cleanup
    type: group
    always_run: true  # Runs even if test fails
    steps:
      - id: power_off
        name: Turn Off Power
        type: action
        driver: rigol_dp832
        action: output_off
        params:
          channel: 1

Next Steps

Continue learning about SeqMaster with these related topics: