Agent Replay Caching for E2E Tests: How TesterArmy Records Once, Replays Until the App Changes
说明与用途
TesterArmy 只记录一次代理动作,随后在应用未变更时重放,降低成本并提升测试确定性。
问题
Agent‑driven E2E tests are expensive and flaky because each run calls a language model and the model can produce different action sequences.
结果
The replay cache reduces token cost to zero after the first run and makes tests deterministic until the app changes, while still allowing manual assertions to detect stale caches.
工作流
- Write a natural‑language goal with agent.act()
- Framework records the resulting action sequence and locator snapshots on first run
- Store the sequence in a JSON cache file per test
- On later runs, check each locator against the current page
- If all locators resolve, replay cached actions
- If any locator fails, invalidate cache and call the agent again
证据
TesterArmy's E2E framework solves the two hard problems of agent-driven testing: cost and flakiness.
On the first run, the framework records every action the agent takes. On subsequent runs, it replays those actions without calling the model until the app changes enough to invalidate the recording.
The framework does not store DOM snapshots. It stores action sequences and the locators that triggered them.
If an assertion fails after a replayed action, the test fails, and you know the cache is stale.
- 记录日期: 2026-10-05T21:41:00.971Z