
测试库
简单而完整的测试实用程序,鼓励良好的测试实践
您的测试越接近软件的使用方式,
它们就能给您带来更多信心。

编写可维护的测试
编写可维护的测试
只有当应用程序出现故障时,测试才会中断,而不是实现细节。

充满信心地开发
充满信心地开发
与用户以相同的方式与应用程序交互

默认情况下可访问
默认情况下可访问
内置选择器以用户的方式查找元素,帮助您编写包容性代码

问题
- 您希望为 UI 创建测试,避免包含实现细节,而是专注于让测试为您提供预期的信心。
- 您希望测试可维护,以便重构(对实现的更改,但不是功能)不会破坏测试并减慢您和团队的速度。
解决方案
Testing Library 家族的库是测试的轻量级解决方案,不包含所有实现细节。它提供的主要实用程序包括以类似用户查找节点的方式查询节点。通过这种方式,testing-library 帮助确保您的测试对 UI 代码有信心。


指导原则
指导原则
您的测试越接近软件的使用方式,它们就能给您带来更多信心。