Start here#
ITF composes a test target from self-describing parts: a target file says what the target is made of, ITF plans it from the parts’ own metadata, and your tests ask for what they need. Three questions lead you to a starter. The words are defined in the glossary of the model.
1. Where does your software run?#
It runs in |
Platform factory |
Starter |
|---|---|---|
a Docker container |
|
|
a machine you reach over SSH (a container with sshd, a QEMU machine, a board) |
|
|
a device with a serial console |
|
|
a board on a hardware bench (power supply, flasher) |
your own factory over the bench’s instruments |
|
the test host itself |
|
|
2. How does ITF reach it?#
You choose a capability factory per role. The common ones:
Role |
What a test does with it |
Factories |
|---|---|---|
|
run a command, get the exit code and output |
|
|
start a program and wrap it |
|
|
copy files in and out |
|
|
an interactive session |
|
|
read and write a console, with recorded lines |
|
|
DLT messages |
|
Swapping how commands run is changing one word, command: docker.exec to command: ssh.exec; the test does not
change. Every pack’s README lists its labels; the list of packs lists all of them.
3. What do your tests need?#
A test asks for roles: @itf.requires("command") and target.command. It can narrow the ask with
contract= and shape=. A test whose role the target lacks is deselected with the reason, so one test file can
run on several target files and each runs what it supports (examples/examples/exec_everywhere).
What to run, in order#
From the repository root, copy a starter inside the examples/ MODULE. In the copied
examples/my_ecu/targets/target.itf.yaml, set policies: [policy.py] and change the # CHANGE: settings.
Keep the module in the copied itf_target.srcs. The policy path is relative to that YAML; see the
policy authoring guide for details.
cd examples
cp -r examples/starter/container examples/my_ecu
# Edit the copied YAML policy path and the # CHANGE: settings before continuing.
itf validate examples/my_ecu/targets/target.itf.yaml
itf graph examples/my_ecu/targets/target.itf.yaml
itf up --detach examples/my_ecu/targets/target.itf.yaml
itf down examples/my_ecu/targets/target.itf.yaml
itf test examples/my_ecu/targets/target.itf.yaml -- examples/my_ecu
With Bazel, itf is bazel run @score_itf//score/itf/cli:itf -- and
bazel test //examples/my_ecu:test runs the same tests.
The commands that do not touch hardware (validate, plan, graph) are safe anywhere, including CI.
Next#
Tutorial: copy a starter, validate, graph, bring up, test, swap a factory, override for one setup.
Get started: the smallest real files, from
MODULE.bazelto a test.The model: the glossary and where each fact lives.
Use, define and enforce contracts: contracts are your project’s own.