Skip to content

Your First Test

This is a 10-minute, hardware-free quickstart. You'll create a tiny test plan and run it offline, with results printed to your terminal. No backend, no Test Runner.

1. Install the plugin

bash
poetry add pytest-f3ts
# or: pip install pytest-f3ts

The plugin registers itself with pytest under the name f3ts.

2. Create config.yml

Every pytest-f3ts run needs a config.yml in the directory you run from. It must define test_name, runner_settings, and test_cases (the limits keyed by test function name):

yaml
test_name: "my-first-test-plan"
runner_settings: {}
test_cases:
  test_voltage:
    test_id: "1.1"
    description: "Demo voltage within tolerance"
    min_limit: 4.90
    max_limit: 5.10

If config.yml is missing or omits test_cases / runner_settings, every test errors — the plugin loads and validates this file before your tests run.

3. Create test_plan.py

python
from pytest_f3ts.utils import log_vars


def measure_voltage():
    """Stand-in for a real measurement (e.g. a DMM reading)."""
    return 5.01


def test_voltage(test_config, record_property):
    meas = measure_voltage()
    log_vars(record_property)  # records `meas` and the limits to the result log
    assert test_config.min_limit <= meas <= test_config.max_limit

test_config is supplied by the plugin from the matching config.yml entry. log_vars records the measured value so it shows up in the result log and summary.

4. Run it

bash
pytest -p f3ts

You'll see, per test, a Test ID: section with the result, and — in an interactive terminal — a FixturFab Test Runner Summary table at the end:

text
Test ID   Test Name        Description                    Min Limit   Measurement   Max Limit   Passed
1.1       test_voltage     Demo voltage within tolerance  4.9         5.01          5.1         True

Two warnings about being "Unable to connect to backend API" are expected — that's the offline fallback. See Running Locally for what each part of the output means and how to handle non-interactive shells.

Next steps