Testing your Application: explain why interdependent tests are bad
维护者通常 7 天内回复
还没有人认领这个 Issue。
评估
- 难度
- 1/5
- 预计耗时
- 1-3 小时
- 新手友好度
- 68/100
- Issue 类型
- 文档
- 描述清晰度
- 描述清楚
- 活跃度
- 停滞
- 技术栈
- typescript
调研方向
先从 issue 中链接的“Data Handling in Testing your Application”部分开始,然后阅读所引用的示例测试和 pull request 讨论,以了解背景。更新文档,解释相互依赖的测试为何存在问题,以及独立测试如何支持隔离执行;完成的标准是同时涵盖失败级联和 it.only()/mocha -g 的使用。
由索引模型根据 Issue 内容生成。
描述
In https://github.com/strongloop/loopback4-example-getting-started/pull/2, the proposed acceptance tests are relying on the first test to fill the database with data that's used by subsequent tests:
it('creates a todo', async () => {
item = (await client
.post('/todo')
.send(payload)
.expect(
Object.assign({}, payload, {
id: 1
})
)).body;
});
//...
it('successfully deletes todos', async () => {
await client.del(`/todo/${item.id}`).send();
await client
.get(`/todo/${item.id}`)
.send()
.expect(404);
});
(see https://github.com/strongloop/loopback4-example-getting-started/pull/2#discussion_r147389550)
This is an anti-pattern to avoid:
- if the first test fails, all subsequent tests fail too (because data was not filled in), but with an unhelpful error message is confusing.
- it is not possible to run individual tests on their own, e.g. via
it.only()ormocha -g "test name".
We should extend Data Handling in Testing your Application to mention this pattern and explain why it's a bad thing to do.
- 主要语言
- TypeScript
- 星标
- 5.1k
- 派生
- 1.1k
- 平均合并
- 2 天 16 小时
- 30 天内合并 PR
- 31
环境准备
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
loopbackio/loopback-next 的其他 Issue
-
难度 2/5 1-3 小时 新手友好度 55/100
loopbackio/loopback-next#11726 ·
维护者通常 7 天内回复
-
bug
难度 5/5 一周以上 新手友好度 35/100
loopbackio/loopback-next#11500 · 1 条评论 · 1 个 reaction ·
维护者通常 7 天内回复
-
bug
难度 3/5 1-2 天 新手友好度 35/100
loopbackio/loopback-next#11412 · 1 条评论 ·
维护者通常 7 天内回复
-
bug help wanted
难度 3/5 1-2 天 新手友好度 45/100
loopbackio/loopback-next#11396 · 2 条评论 · 1 个 reaction ·
维护者通常 7 天内回复
-
bug help wanted
难度 3/5 1-2 天 新手友好度 48/100
loopbackio/loopback-next#11363 · 3 条评论 ·
维护者通常 7 天内回复
查看 loopbackio/loopback-next 的全部 Issue
相似的 Issue
-
ADD openalgo未关闭template
难度 2/5 1-3 小时 新手友好度 75/100
维护者通常 1 天内回复
-
factory-active factory-automatic task-bug-reproduction-success task-identify-harness-labels-done task-identify-issue-type-done
难度 2/5 1-3 小时 新手友好度 90/100
维护者通常 1 天内回复
-
bug Needs: Triage :mag:
难度 2/5 1-3 小时 新手友好度 84/100
microsoft/fluentui-contrib#671 ·
-
难度 2/5 1-3 小时 新手友好度 88/100
sveltejs/acorn-typescript#150 ·
-
难度 2/5 1-3 小时 新手友好度 78/100