Welcome to OpenHTF

OpenHTF (Open Hardware Testing Framework) is an open-source Python framework for hardware testing, originally created at Google.

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 team at TofuPilot, a plug-and-play database and analytics app 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:

Phases

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

Measurements

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

Plugs

Handle external hardware/software interactions with reusable components.

Test Records

Structured output containing test results, measurements, and execution data.

main.py
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: "SN0001") # DUT S/N

if __name__ == "__main__":
    main()
multimeter_plug.py
from openhtf.plugs import BasePlug

class MultimeterPlug(BasePlug):
    # Simulate connecting to the multimeter
    def __init__(self):
        self.connected = True

    # Simulate measuring the voltage
    def measure_voltage(self):
        return 3.3

    # Simulate disconnecting from the multimeter
    # Called automatically by OpenHTF at test end
    def tearDown(self):
        self.connected = False

On this page

First-pass yield
0%4.1
Track with TofuPilot