Welcome to OpenHTF

OpenHTF (Open Hardware Testing Framework) is an open-source Python framework for hardware testing.

Originally created at Google, OpenHTF is now used by hundreds of teams worldwide, from startups to large companies, across all stages of product development: verification in design, validation in prototyping, and manufacturing.

This documentation is provided by the TofuPilot team, a database with analytics designed for OpenHTF tests.

Quick example

OpenHTF tests are Python scripts that run a series of test steps on a Unit Under Test (UUT), usually involving data and performing measurements.

OpenHTF handles the setup, execution, and teardown of the test, keeps track of everything gathered and provides a pass/fail outcome.

Here are the key concepts in OpenHTF:

  • Name
    Phases
    Description

    Test steps perform actions and return pass, fail, or skip result.

  • Name
    Measurements
    Description

    Capture specific values during phases with optional pass/fail validators.

  • Name
    Plugs
    Description

    Handle external hardware/software interactions with reusable components.

Example

import openhtf as htf
from openhtf.plugs import plug
from multimeter_plug import MultimeterPlug

@plug(multimeter=MultimeterPlug)
@htf.measures(
  htf.Measurement('voltage')
  .in_range(3.0, 3.5)
  .with_units('V'))
def test_voltage(test, multimeter):
  voltage = multimeter.measure_voltage()
  test.measurements.voltage = voltage

def main():
  test = htf.Test(test_voltage)
  test.execute(lambda: "PCB0001") # UUT S/N

if __name__ == '__main__':
    main()

Was this page helpful?