Phases
Structure your hardware tests with phases.

Overview
A test procedure in TofuPilot is made of sequential phases. These represent logical blocks of a test. Each phase performs a specific function and records its own start and end time, as well as its outcome.
Integration
TofuPilot tracks each phase with its name, outcome, and duration. With OpenHTF, you simply define the phases in the Test
, and TofuPilot collects the information automatically.
import openhtf as htf
from tofupilot.openhtf import TofuPilot
def phase_one(test): # Phase name is the function name
return htf.PhaseResult.CONTINUE # Pass status
def main():
test = htf.Test(phase_one, procedure_id="FVT1", part_number="PCB1")
with TofuPilot(test):
# duration and start time are automatically set
test.execute(lambda: "PCB1A001")
if __name__ == "__main__":
main()
Phases properties
- Name
phases
- Type
- array
- Description
List of phases.
- Name
name
- Type
- str
- Description
The name of the phase.
- Name
outcome
- Type
- "PASS" | "FAIL" | "ERROR" | "SKIP"
- Description
Result of the phase. Example: "PASS"
- Name
start_time_millis
- Type
- number (optional)
- Description
Start time (Unix ms). Example: 1726147200000
- Name
end_time_millis
- Type
- number (optional)
- Description
End time (Unix ms). Example: 1726147230000
- Name
measurements
- Type
- array (optional)
- Description
List of measurements in the phase.
In-app view
Run page
Each test run shows a breakdown of all phases and their associated measurements.

Procedure Page
Clicking a phase in the Run page opens the Procedure page. You can analyze all historical data for that phase: average duration, yield, number of runs, and Cpk.

These features will be explained in more detail in the Test phases analysis section.