Skip to content

测试 Suite

一句话解释

测试 suite 是分组的 related 测试. 例如, 所有测试 for Calculator 类表单 one suite.

用大白话说

测试 suite 是如 folder for related 测试. 相反的 有 hundreds 的测试 in one 大列表, 你分组它们到 suites 通过什么它们测试.

For 示例, 你可能有 one suite for 'Calculator 测试', another for '用户 service 测试', and another for '字符串 utils 测试'. 每个 suite 包含多个测试情况那个所有测试相同模块 or feature.

In Jest, 你创建 suite 使用 描述(). Suites 能也 是 nested — '用户 service' suite 可能包含 sub-suites for '创建', '更新', and '删除' 操作.

示例

javascript
describe('Calculator', () => {
  test('adds correctly', () => { /* ... */ });
  test('subtracts correctly', () => { /* ... */ });
  test('handles division by zero', () => { /* ... */ });
});

描述() 创建测试 suite 分组所有 Calculator-related 测试.

相关术语

相关资源

相关课程

解读错误信息

用大白话解释常见错误——什么意思、为什么发生、如何修复。

查看错误

← 返回术语表