Phases
Organize your test flow by breaking it down into multiple phases.
Overview
A hardware test typically consists of several phases that perform measurements and validation. TofuPilot provides an easy way to record phase details and analyze performance across all executions, giving you precise analytics on phase failure rates and durations.
Integration
You can create and add various test phases and view the automatically generated reports on the Run page.
Required parameters
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):
test.execute(lambda: "PCB1A001") # duration and start time are automatically set
if __name__ == '__main__':
main()
- Name
name
- Type
- str
- Description
The name of the phase.
- Name
outcome
- Type
- "PASS" | "FAIL" | "ERROR" | "SKIP", required
- Description
Outcome of the phase. Example: "PASS"
- Name
start_time_millis
- Type
- number
- Description
A Unix epoch timestamp in milliseconds representing the start time of the phase. Example: 1726147200000
- Name
end_time_millis
- Type
- number
- Description
A Unix epoch timestamp in milliseconds representing the end time of the phase. Example: 1726147230000
Optional parameters
import openhtf as htf
from tofupilot.openhtf import TofuPilot
# Decorator to set measurement name, unit and limits
@htf.measures(
htf.Measurement("voltage")
.in_range(3.1, 3.5)
.with_units(units.VOLT)
)
# Phase returns a Pass status because measurement (3.3) is within defined limits [3.1, 3.5]
def phase_voltage_measure(test):
test.measurements.voltage = 3.3
def main():
test = htf.Test(
phase_voltage_measure,
procedure_id="FVT1",
part_number="PCB1"
)
with TofuPilot(test):
test.execute(lambda: "PCB1A001")
if __name__ == "__main__":
main()
- Name
measurements
- Type
- array, optional
- Description
The array of one or several measurement in one phase.
- Name
name
- Type
- string, required
- Description
The name of one measurement.
- Name
outcome
- Type
- "PASS" | "FAIL" | "UNSET", required
- Description
Outcome of the measurement. Example: "PASS"
- Name
measured_value
- Type
- number | string | boolean | JSON, optional
- Description
The value of the measurement.
- Name
units
- Type
- string, optional
- Description
The units of the value. Examples: Celsius Degrees, Voltage
- Name
lower_limit
- Type
- number, optional
- Description
Minimum threshold. Only taken into account if measured_value is a number. Example: 3.2
- Name
upper_limit
- Type
- number, optional
- Description
Maximum threshold. Only taken into account if measured_value is a number. Example: 13.2
In-app view
Run page
You can view each test phase in the Phases section on the Run page.
Procedure Page
Clicking on a test phase from the Run page redirects you to the Procedure page, where you can see all executed runs of this procedure, sorted by that phase. You can navigate between different tabs to view the average Duration for each phase, the Yields, quantity of Runs, and Cpk.
You can view phase details in the tabs or the Control Chart by clicking on a phase (e.g., phase_one
). The Control Chart displays limits lower_limit
and upper_limit
and the 6-sigma standard deviation, calculated automatically.
If the limit definitions have changed over time, the most recent limits provided will be used.
To unselect a phase, click its name on the top bar of the page or click on Clear Filter.
Advanced integration
You can find an example of Phases functionalities in this script, including measured values, limits, units, and multiple measurements.
import openhtf as htf
from tofupilot.openhtf import TofuPilot
from openhtf.util import units
# Phase without measurement
def phase_connect():
htf.PhaseResult.CONTINUE
# Phase with one measure
@htf.measures(htf.Measurement("firmware_version").equals("v2.5.1"))
def phase_firmware_version_check(test):
test.measurements.firmware_version = "v2.5.1"
# Phase with multiple measurements
@htf.measures(
htf.Measurement("input_voltage").in_range(3.1, 3.5).with_units(units.VOLT),
htf.Measurement("output_voltage").in_range(1.1, 1.3).with_units(units.VOLT),
)
def phase_voltage_measurements(test):
test.measurements.input_voltage = 3.3
test.measurements.output_voltage = 1.2
def main():
test = htf.Test(
phase_connect,
phase_firmware_version_check,
phase_voltage_measurements,
procedure_id="FVT2",
procedure_name="Functional PCBA Testing",
part_number="PCB1",
)
with TofuPilot(test):
test.execute(lambda: "PCB1A002")
if __name__ == "__main__":
main()
You can see the result on the Run page.