Device under test (DUT)

Track the serial number of the unit under test with each run.

OpenHTF Unit Under Test (UUT) section header with TofuPilot integration.

Overview

When running tests, tracking serial numbers is important for traceability. With OpenHTF, you can either manually enter the serial number at the start of the test or set it programmatically during the test.

Prompt at start

You can prompt the operator to input the serial number manually at the start of the test.

main.py

from openhtf import Test, PhaseResult
from openhtf.plugs import user_input

def power_on(test):
    return PhaseResult.CONTINUE

def main():
    test = Test(power_on)
    test.execute(test_start=user_input.prompt_for_test_start()) # Prompt at start

if __name__ == '__main__':
    main()

When executed, the script prompts the user to enter a serial number.

Enter a UUT ID in order to start the test.
--> PCB001

======================= test: openhtf_test  outcome: PASS ======================

Set at start

You can set the serial number at the start of the test.

main.py

from openhtf import Test, PhaseResult

def power_on(test):
    return PhaseResult.CONTINUE

def main():
    test = Test(power_on)
    test.execute(lambda: 'PCB001') # Set at start

if __name__ == '__main__':
    main()

Set during test

You can set the serial number during the test.

main.py

from openhtf import Test, PhaseResult

def get_sn(test):
    test.test_record.dut_id = 'PCB001' # Set during test
    return PhaseResult.CONTINUE

def main():
    test = Test(get_sn)
    test.execute()

if __name__ == '__main__':
    main()

Was this page helpful?