Skip to main content
This guide walks you through a complete test workflow, in Python or in Rust. It starts at connectivity and ends at an automated test. At the end, you can use the CLI interactively and write your own Lager test scripts.
First complete the Getting Started guide. This tutorial assumes that you installed the CLI, added your box, and configured your instruments with nets.

Part 1: CLI Walkthrough

Let’s step through a typical test flow using individual CLI commands. This is useful for ad-hoc testing, debugging, and getting familiar with your setup.

Step 1: Verify your box is online

Expected output:

Step 2: Check connected instruments

This shows all instruments the box can see. Confirm your power supply, debug probe, and any other instruments appear.

Step 3: View your configured nets

This shows the named nets you’ll use in subsequent commands. Note the net names — you’ll need them below.

Step 4: Set defaults to reduce typing

With defaults set, you can omit --box and net names from subsequent commands.

Step 5: Flash firmware

Expected output:

Step 6: Power on your device

Step 7: Take a measurement

Expected output:

Step 8: Power down

Always disable power supplies when you’re done testing.

Part 2: Your First Test Script

Now convert the manual CLI steps into a repeatable test. A script always cleans up after itself and disables power, even when an error occurs. You can write it in Python, which runs on the box through lager python. You can also write it in Rust, as an ordinary cargo test in your firmware repository that uses the lager-net crate. Both versions below flash, power on, measure, assert, and clean up.
Cleanup protects your hardware, so both versions do it. The Python version uses try/finally, which disables the power supply even when an error occurs. The Rust version disables power before its assertion. An earlier ? error also ends the test, and the failure shows the state of the supply.

Part 3: Running It

Execute the Python script on your Lager Box:
Or run the Rust test from your project (with lager = { package = "lager-net", version = "0.4" } in [dev-dependencies]):
Expected output (Python):
If you need to send additional files along with your script (firmware binaries, config files), use --add-file:

What’s Next

You’ve completed your first test with Lager. Here are some directions to explore:
  • CLI Reference — Full documentation for every CLI command
  • Python API — Complete Python SDK reference
  • Rust API — Write your HIL suite as cargo test integration tests
  • Troubleshooting — Solutions when things go wrong
  • Glossary — Definitions for technical terms used in the docs
The demo script is a larger example. It combines robot arm control, USB hub power cycling, debug probe flashing, and ADC measurement.