跳到主要内容
学院
初级 代码街区

测试

放心发布:单元测试、集成测试和端到端测试。

Tests are code that checks your code, so you can change things without fear. This track starts with your first expect in Vitest and ends with a team's whole safety net: clear unit tests, edge cases and boundaries, test doubles for time and randomness, an integration test for a Go web handler, end-to-end tests that drive a real browser with Playwright, flaky tests and how to kill them, and the red, green, refactor loop of TDD.

Examples use TypeScript with Vitest, one Go test and Playwright, all on the features of a small social app called Nova: points, tiers, leaderboards, sign-ups and posts. Basic JavaScript or TypeScript is all you need to start.

课时
14
时长
2 小时
级别
初级

本课程的内容目前为英文。

  • 铜牌 可挑战
  • 银牌 可挑战
  • 金牌 未解锁

准备好证明自己了吗?

三场考试正等着你:铜牌、银牌和金牌。

前往考试

学完后你将能够

  • Write clear unit tests with Vitest's describe, it and expect
  • Hunt edge cases and test both sides of every boundary
  • Replace clocks, randomness and email with test doubles
  • Test a Go HTTP handler with httptest
  • Drive a real browser with Playwright, without sleeps or hardcoded ports
  • Work in a red, green, refactor loop and read coverage wisely

学习旅程

  1. 1
    第 1 单元

    Your first tests

    Why tests matter, the shape of a good test, edge cases and test doubles.

    0 / 5
  2. 2
    第 2 单元

    Testing like a team

    The test pyramid, integration and end-to-end tests, flaky tests and TDD.

    0 / 5
  3. 3
    第 3 单元

    The road ahead

    Beyond the basics: property-based tests, contract tests, mutation testing and load tests.

    0 / 4

快速导航