Technology

Engineering record

VerificationIn use

Replacing handwritten tests with model-based verification

Handwritten tests cover only the sequences people think of. To find the ones we missed, we replay sequences made by a model on the real code.

In June, 910 passing tests still didn't let us say the app did the same things as the original. In October, the results for recorded scenes were almost all identical, yet many features were missing. In both cases, whatever we hadn't checked never showed up as a failure.

Writing more scenario tests would increase the number of orders we check. But a person would still have to think of the moment the app is killed, the moment an answer is lost, the moment two devices save at once. And every time we changed the structure, we had to rewrite the tests. Is the problem too few tests, or is the limit that people write out each order to check by hand?

Write the rules, not the orders

Where we can, we block invalid states with types and database constraints. The rules that remain we write as a Quint model. A model describes not one order but what is possible and what must always hold. Quint Connect runs the orders the model generates on the real engine, as they are. We call this replay.

For smaller scopes we could use proptest-state-machine, for asynchronous code on screens fast-check, and for narrow numeric functions Kani. But if we stack several similar tools on one problem, we then have to manage which tool owns what. Proof tools like Verus and Lean we'll consider when a concrete problem comes up that our current method can't solve. We haven't yet run and compared every candidate.

In REDDY we changed 26 files, adding 1,193 lines and deleting 10,541. We kept the fake phone and server so they could run the model's orders.

There is still something to doubt. This time a person writes the model instead of scenarios. If the model's rules are wrong, replay only checks that the code fits the wrong rules well. So we decided not to treat a model that merely transcribes today's code as the right answer.

Written from that day’s point of view, using the documents and change history of the time. Published 2026.12.01.