Units
Track serial numbers, part numbers and revisions of test units.
Overview
A Unit is a physical object being tested. Each Unit has a unique serial number and is defined by part number and revision for complete traceability.
In TofuPilot, we use "Unit" as the standard term. However, you may also see "Unit under test" (UUT) or "Device under test" (DUT) in OpenHTF and other testing frameworks. All refer to the same concept.
Create Units
Units are created automatically when creating a Run.
Parameters
- OpenHTF: Define parameters in the
Test
constructor (part_number
,revision
,batch_number
) and pass the serial number totest.execute()
. - Python: Use the
unit_under_test
dictionary increate_run()
to defineserial_number
,part_number
,revision
, andbatch_number
.
Prop | Type | Default |
---|---|---|
unit_under_test? | dict | – |
serial_number? | str | – |
part_number? | str | – |
revision? | str (optional) | A |
batch_number? | str (optional) | – |
from openhtf import Test
from tofupilot.openhtf import TofuPilot
def main():
test = Test(
procedure_id="FVT1",
part_number="PCB01", # required
revision="A", # optional
batch_number="12-24", # optional
)
with TofuPilot(test):
test.execute(lambda: "SN-0001") # Unit serial number (required)
if __name__ == "__main__":
main()
from tofupilot import TofuPilotClient
def main():
client = TofuPilotClient()
client.create_run(
procedure_id="FVT1",
unit_under_test={
"serial_number": "SN-0001", # Unit serial number (required)
"part_number": "PCB01", # required
"revision": "A", # optional
"batch_number": "12-24", # optional
},
run_passed=True,
)
if __name__ == "__main__":
main()
With OpenHTF, you can decide whether to assign the serial number at the beginning of the test or later during execution. For more details, see the Operator UI section in the OpenHTF documentation.
Batch Number
Include the batch_number
field in your script. TofuPilot will display it with the run and let you filter analytics by batch.
Revision
Specify the revision
field. If omitted, revision A
is assumed. Revisions are shown in the Inventory and Unit pages, and can be used to segment your analytics.
Sub-units
Sub-units are smaller Units that get assembled into a larger Unit. Each sub-unit has its own serial number and test history.
- OpenHTF: Define
sub_units
parameter in theTest
constructor as a list of dictionaries withserial_number
of each sub-unit. - Python: Use the
sub_units
field increate_run()
as a list of dictionaries containing theserial_number
of previously tested sub-units.
Prop | Type | Default |
---|---|---|
sub_units? | array (optional) | – |
serial_number? | str (optional) | – |
from openhtf import PhaseResult, Test
from tofupilot.openhtf import TofuPilot
# Please ensure both units PCB1A001 and LEN1A001 exist before running this script
def main():
test = Test(
procedure_id="FVT2", # Create the procedure first in the Application
part_number="CAM1",
sub_units=[{"serial_number": "PCB1A001"},
{"serial_number": "LEN1A001"}],
)
with TofuPilot(test):
test.execute(lambda: "CAM1A001")
if __name__ == "__main__":
main()
from tofupilot import TofuPilotClient
# Please ensure both units PCB1A001 and LEN1A001 exist before running this script
def main():
client = TofuPilotClient()
client.create_run(
procedure_id="FVT2", # Create the procedure first in the Application
unit_under_test={"serial_number": "CAM1A001", "part_number": "CAM1"},
run_passed=True,
sub_units=[{"serial_number": "PCB1A001"},
{"serial_number": "LEN1A001"}],
)
if __name__ == "__main__":
main()
The sub-units must already exist as Units in TofuPilot when creating the Run. Ensure each sub-unit has been tested and registered before referencing it in the assembly.
Modify Units
Modify units in two ways:
- In the app: Click a unit from a Run page to open its Unit page and edit serial number, part number, or revision
- In your script: Change information directly when creating Runs - updated values will reflect in the Unit
Unit Activity
Track unit activity on its page. Shows all tests performed on the unit, grouped by Procedure name, and changes made when creating Runs (adding or removing sub-units, number of Runs by Units with Procedure name).
Delete Units
Delete units either:
- In the app: from the unit’s page
- Via API: using the
delete_unit()
function to automate cleanup
How is this guide?