Unit under test (UUT)
Track the serial number of the unit under test with each run.
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.
With the TofuPilot integration, a detailed page is automatically created for each unit, showing all tests performed and allowing performance comparisons between different component types, revisions, or batches.
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()
TofuPilot integration
The TofuPilot integration automatically uploads the OpenHTF report to your TofuPilot using the UUT's serial number.
To integrate TofuPilot, install the open-source client:
pip install tofupilot
Add it to your test like this:
main.py
from openhtf import Test, PhaseResult
from tofupilot.openhtf import TofuPilot
def get_sn(test):
test.test_record.dut_id = 'PCB001'
return PhaseResult.CONTINUE
def main():
test = Test(get_sn)
with TofuPilot(test):
test.execute()
if __name__ == '__main__':
main()
The first run will prompt for your API key if you're not signed up. A dedicated page is created for each test run:
On the unit page, you can view all runs conducted on this unit across all test procedures.
You can extend OpenHTF to track part numbers, revisions, batch numbers, and sub-units in TofuPilot.
Learn more in the TofuPilot Docs