The single most useful testing rule for model-backed code is this: decide what question the test answers before you decide how it gets its answer. A test that checks your JSON parser should not need a live provider, a current model and a healthy rate limit to be green. The live dependency adds noise to a deterministic assertion, and a test that flakes for reasons unrelated to the code under test trains the team to rerun instead of debug, which is how expensive tests become weak tests 12.
Prompt testing as a discipline runs a prompt and its full configuration (model, temperature, tools, response format, retrieval) against representative inputs with explicit expectations, and scores each run the same way. That is a different activity from unit testing deterministic code, and Braintrust lays out the distinction clearly: prompt tests answer "does this configuration still behave correctly on the cases we care about," while unit tests answer "does this deterministic code return the expected value" and run in seconds on every commit 11. Keeping those two questions separate is the precondition for everything below.
The second precondition is knowing what each layer can and cannot prove. The same Braintrust comparison notes that prompt edits which add examples or reasoning instructions can improve accuracy while also increasing latency and token spend, so cost and latency belong in the same test run as quality, not in a separate review 11. If you are going to spend a live call, make it earn its keep by covering the expensive dimensions too.



