Loading page...Загружаем страницу...正在加载页面...
AtlasRepo

How and why you need to speed up tests

说明与用途

过多的测试导致资源耗尽和运行时间过长,拖慢了开发进度。通过减少测试、使用主机数据库、事务回滚和禁用触发器等策略,可以加快执行速度并提升效率。

问题

An excessive number of tests caused resource exhaustion and long test runtimes, slowing development.

结果

Adopting these practices reduced test execution time, mitigated resource exhaustion, and accelerated development cycles.

工作流

  • Prohibit agents from writing tests for obvious changes (e.g., migration scripts, enum additions, dependency list changes).
  • Prevent duplicate tests by combining similar checks into a single test and adding a test audit skill for agents.
  • Raise application context only once for all tests to avoid repeated setup.
  • Use host database instead of test containers to save Docker memory and startup time.
  • Deploy database schema once for all tests and clean the database by rolling back transactions instead of deleting rows.
  • Disable triggers before clearing tables to reduce test runtime.
  • Run only tests affected by the current code changes during development.
  • Adjust pipeline CPU core power‑saving mode to speed up tests.

证据

The tests started consuming too many resources. The test bench encountered: OOMError, memory exhaustion in the database, exhaustion of lock and database connection limits.

来源

If in spring a full test run took 10–15 minutes, in autumn it slowed down to 45 minutes.

来源

We save: on Docker memory (relevant for Macs), on the time it takes to start the test containers, and on the time spent recreating the database schema from scratch for each test.

来源

Disable triggers before clearing the tables in the test database. For me, this reduced the time required to run all tests by 15 minutes.

来源

  • 记录日期: 2026-11-03T20:28:46.505Z