Sub-units
Assemble and track the sub-units of the unit under test.

Overview
Most hardware products are made of multiple components, tested individually and at each phase of assembly to the final product. TofuPilot's sub-unit features enable automatic test traceability through the entire process.
Integration
You can define sub_units
in your assembly test as a list of dictionaries. Each dictionary represents a sub-unit with the key serial_number
for its serial number.
from openhtf import PhaseResult, Test
from tofupilot.openhtf import TofuPilot
# Please ensure both units PCB1A001 and LEN1A001 exist before running this script
# Refer to https://tofupilot.com/docs/procedures for an example on how to
# create them
def main():
test = Test(
procedure_id="FVT2",
procedure_name="Camera Assembly",
part_number="CAM1",
sub_units=[{"serial_number": "PCB1A001"}, {"serial_number": "LEN1A001"}],
)
with TofuPilot(test):
test.execute(lambda: "CAM1A001")
if __name__ == "__main__":
main()
In-app view
You can see in this example the creation of the camera assembly with its sub-units listed as children in the Units page. You can navigate to these sub-units using the expansion menu on the left.

On the specific camera assembly Unit page, the Sub-units section allows you to view and navigate to their individual pages.
