What is it?
TestFlows Machine is a deterministic simulation testing environment for developers and AI coding agents. You run, explore, debug and test your software in it, yourself or with an AI coding agent. It is built on our deterministic hypervisor, which runs your programs, Docker images and Docker Compose environments unchanged.
Nothing in the machine is left to chance. It controls time, interrupts, random numbers and input from devices, and it records all of them while your program runs. Replay the recording and the program does exactly what it did the first time, instruction for instruction.
That gives you three things to work with:
- Record. Every run keeps a log of everything that could have turned out differently.
- Replay. Play the log back and the run repeats itself. If it failed once, it fails every time.
- Branch. Stop at any point, branch from it, and try something else. The original run stays as it was.
A test that fails one run in fifty fails every time it is replayed. Record the failing run once, then replay it as often as you need.
You work with Machine through a client called machine, or from Python using
the SDK. An AI coding agent uses the same client and SDK, and
the guide for AI agents shows it where to start. To begin,
install the client. It is one command, and
the Free plan needs no payment details.
Questions, feature requests and bug reports are welcome in the TestFlows Machine repository on GitHub. See Getting help.
Concepts
There are seven of them, and the rest builds on them.
Disk. What a machine boots. It is your program (or a whole application)
packaged with a small Linux system. You build one with machine disks build.
Session. The vCPUs and RAM you allocate, which one or more runs execute in. It is what you are billed for, from the moment you create it until you delete it, so delete it when you are done.
Run. A deterministic machine booting a disk inside a session. Every run has a name. Nearly every action is something you do to a run.
Entry. A run writes its history as a log. Each item in the log is an entry. Entry #42 is always the same point in that run.
Checkpoint. A saved copy of the whole machine at one point in the log. Every run has checkpoint 1, taken at its first entry, and you can add your own and name them.
Branch. A run that starts from another run at some point, its fork point.
It shares history with its parent up to the fork point and has its own after
it. You create one with machine fork or machine go. A run and its
branches form a tree. The ancestors of a branch, from the root of its tree
down, are its lineage.
Mark. A second name for a branch, given after the fact. The generated name
says where a branch started. A mark says what it turned out to be,
like crashed.
Points
A lot of commands take a point, which is a place in a run’s history. You can name one in several ways.
| Point | Means |
|---|---|
^booted |
the checkpoint named booted |
#42 |
entry 42 |
1.5s |
a time on the machine’s clock |
-10ms |
ten milliseconds of machine time back from where the run is now |
-10 |
ten entries back from where the run is now |
now |
where the run is now |
parent |
this run’s fork point |
parent 2 |
the fork point of this run’s parent |
root |
the point where this run’s lineage leaves the root of its tree |
%crashed |
the point where this run’s lineage leaves the branch marked crashed |
console~login |
where the console first printed a match of login |
console:120 |
where the console printed its line 120 |
Every point is on the lineage of the run it is given for. A mark therefore
names a point only when the marked branch is an ancestor of that run. A machine
time such as 1.5s or -10ms names the first entry at the last machine time
at or before the one you asked for.
The same points work everywhere a point is taken: --at on fork, detach
and go, rewind ... to, and replay --to. --from takes them too, except
now. A bare word is
read as a checkpoint’s name first, then as a time, then as an entry, so write
^name or #42 when you mean one of them for sure.
A branch can only start from a checkpoint.
machine go and machine fork
take any of these points. If the one you name isn’t a checkpoint, they start
the branch at the nearest checkpoint before it and replay the rest of the way
for you. fork --no-start refuses such a point, because it leaves no machine
to replay on, and so does detach.