← All Learning Paths

Testing Infrastructure Engineer

Build the scaffolding tests stand on: test doubles, data builders, fixture isolation, order independence, Testcontainers, and a React Testing Library quickstart.

technicalintermediate8 nodes11.33h total

Path overview

测试基础设施决定团队写测试的体验:替身混乱、夹具串味,测试就会沦为负担。本路径从替身与数据构建器讲起,覆盖夹具隔离与顺序无关性,再落地三个配方与 React Testing Library 工作流。

Test infrastructure decides whether writing tests feels like craft or chore. This path covers doubles, builders, fixture isolation, order independence, Testcontainers, and an RTL quickstart.

  1. Read "Testing Strategies: Unit, Integration, and E2E" for the "Structure your tests across the test pyramid: fast unit tests, contract-driven integration" argument, then name the decision in testing work it would change.

    Completion criteria: Record a short walkthrough of "Testing Strategies: Unit, Integration, and E2E" with timestamps at "Structure your tests across the test pyramid: fast unit tests, contract-driven integration" and "The Test Pyramid", plus the commit that applies it.

    Next step: Vitest

    ⏱ 1h

  2. Read "Vitest"'s documented surface around "expect expect(actual: unknown): Assertion", then build a minimal endpoint and log the response.

    Prerequisites: Testing Strategies: Unit, Integration, and E2E

    Completion criteria: Attach one successful call and one invalid call against "Vitest", citing "vi.mock vi.mock(path: string, factory?: () => unknown): void" as the documented surface.

    Next step: Add a Test Data Builder

    ⏱ 1h

  3. Execute "Add a Test Data Builder" end to end, then repeat the last step with one parameter changed and compare "Tests construct a valid user with one line and override only relevant fields.".

    Prerequisites: Vitest

    Completion criteria: Deliver a transcript of "Add a Test Data Builder" with each step's command and observed state, ending at "Tests construct a valid user with one line and override only relevant fields.".

    Next step: Isolate Test Fixtures Between Tests

    ⏱ 0.5h

  4. Run "Make database-backed tests independent and parallel-safe without truncating shared tables" from "Isolate Test Fixtures Between Tests" and confirm the documented result "app_template contains every table and index, and a row count on users returns zero.".

    Prerequisites: Add a Test Data Builder

    Completion criteria: Run "Isolate Test Fixtures Between Tests" twice — once as written and once with a changed input — and attach both transcripts with the observed difference.

    Next step: Run Integration Tests With Testcontainers

    ⏱ 0.5h

  5. Apply "Run Integration Tests With Testcontainers" to a testing task, checking that "Install the PostgreSQL Testcontainers module and the pg driver." appears after the "Both packages appear in devDependencies and the lockfile is updated." step.

    Prerequisites: Isolate Test Fixtures Between Tests

    Completion criteria: Run the steps through "Both packages appear in devDependencies and the lockfile is updated.", paste the command output, and mark the line that matches "Install the PostgreSQL Testcontainers module and the pg driver."; then rerun with one parameter changed.

    Next step: Set Up React Testing Library with Vitest

    ⏱ 0.5h

  6. Use "Set Up React Testing Library with Vitest" to decide "package.json includes vitest ^2.x, @testing-library/react ^16.x, @testing-library/jest-dom", then prove the outcome with "Configure a React project with Vitest and React Testing Library, write a component test that".

    Prerequisites: Run Integration Tests With Testcontainers

    Completion criteria: Record the state "Configure a React project with Vitest and React Testing Library, write a component test that" at the verification step, then paste the output of "package.json includes vitest ^2.x, @testing-library/react ^16.x, @testing-library/jest-dom" that proves it.

    Next step: Generate a Test Matrix with Exclusions

    ⏱ 0.5h

  7. Build "Generate a Test Matrix with Exclusions" for testing code and verify {total:4,selected:3,sample:[{browser:chromium,os:linux},{browser:chrom against both samples.

    Prerequisites: Set Up React Testing Library with Vitest

    Completion criteria: Attach the solution file for "Testing Infrastructure Engineer", two passing sample runs, and one failing run whose error matches the contract.

    Next step: Capstone: Testing Infrastructure Engineer

    ⏱ 0.33h

  8. Ship "CORS and default headers are configurable globally without repeating them per route" from "Build a Config-Driven API Mock Server", then prove it with the project's test suite and an acceptance note.

    Prerequisites: Set Up React Testing Library with Vitest, Generate a Test Matrix with Exclusions

    Completion criteria: Run the project's test command for "Build a Config-Driven API Mock Server", paste the passing output, and attach the acceptance note for "CORS and default headers are configurable globally without repeating them per route" with the test name.

    Next step: Run the capstone's tests, publish the repository, and demo it to a reviewer.

    ⏱ 4h