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

4,300 tests, written by an AI: how they were planned, run and enforced

说明与用途

ParkEase 使用 Claude Code 构建,采用“先测试”策略,结合真实基础设施和强制性集成测试套件,降低错误率并确保代码可靠性。

问题

Ensuring AI‑generated code is correct requires a robust testing strategy that treats tests as contracts rather than a post‑hoc phase.

结果

Adopting a test‑first, test‑driven workflow with real infrastructure and mandatory suites reduced bugs, ensured critical invariants, and made the testing process a contract that AI‑generated code had to satisfy.

工作流

  • 1. Write a failing test before code (test‑first).
  • 2. Create a test plan entry for each task in the registry.
  • 3. Use real PostgreSQL 18 with PostGIS in a throwaway container for integration tests.
  • 4. Run four mandatory integration suites (booking concurrency, ledger balance, idempotency, search performance) on every change.
  • 5. Perform stress tests (100 drivers racing for 10 slots).
  • 6. Run API tests through real HTTP to exercise guards and interceptors.
  • 7. Add component tests for new screens and table‑driven tests for data screens.
  • 8. Execute Playwright end‑to‑end runs on phone and desktop sizes with accessibility scans.
  • 9. Run lint, typecheck, unit suites, mandatory integration suites, dependency audit, and secret scan locally before PR.
  • 10. Log gaps such as fixture mismatches and lack of real Android devices.

证据

Tests weren’t a phase at the end. They were the contract the generated code had to meet.

来源

Integration tests run against a real PostgreSQL 18 with PostGIS in a throwaway container. No mocked database.

来源

Four integration suites are mandatory on every change: booking concurrency, ledger balance, idempotency, search performance.

来源

API tests go through HTTP. Tests that call a command directly skip the guards, interceptors, status codes and error envelopes.

来源

The last gate before any pull request: lint, typecheck, every unit suite, the four mandatory integration suites, a dependency audit and a secret scan, run locally, with the output pasted into the PR.

来源

  • 记录日期: 2026-11-02T09:58:49.861Z