TT Lab
博客

한국어 English 日本語 中文

开始
博客

博客

What did you expect to happen: Bug Report 的基础,期望的行为与实际的行为

今日英文表达 2/30 · 阶段:开启 Issue。 所有例句均为本文虚构。并非摘自实际仓库的评论,版本和命令仅为示例。

目录

概览

表达 Expected behavior / Actual behavior, What did you expect to happen?
含义 期望的行为 / 实际的行为,原本应该发生什么?
使用场景 Bug Issue 正文、Issue 模板、要求复现的评论
礼貌程度 中立。由于采用分段记录事实的形式,不带任何情绪

1. 含义与语感

在 Bug 报告中,维护者最想了解的两件事是: 实际发生了什么(actual behavior),以及 报告者认为应该发生什么(expected behavior)。两者之间的差距就是 Bug 的定义。如果你的期望与文档不同,这可能不是 Bug 而是误解,所以如果把期望单独写出来,维护者就能更快地回复“这是预期的行为”。

Kubernetes 的 Bug 报告模板将前三个格子设为 What happened?, What did you expect to happen?, How can we reproduce it (as minimally and precisely as possible)?。许多仓库都采用这种结构。即使是没有模板的仓库,直接使用这三个标题也能写出一个易读的 Issue。

请注意时态。由于实际行为是已经发生的事情,因此要使用过去时(The pod was evicted)或现在时(The controller logs an error)。对于期望的行为,请使用 should 或 expected ... to (The VM should stay running, I expected the backup to complete)。

2. 例句

情况 1:Issue 正文的两个格子

What happened: After upgrading to v1.3.0, virtctl restart returns immediately, but the VM stays in Stopped.

What did you expect to happen: The VM should be restarted and reach Running, as it did on v1.2.x.

补充说明在之前的版本中是如何表现的(as it did on v1.2.x),可以立即暴露出这是一个回归(regression)问题。

情况 2:将 Expected 和 Actual 作为小标题分开时

Expected behavior

The scheduled backup completes and a new object appears in the bucket.

Actual behavior

The backup stays in running for more than an hour, and no object is written.

情况 3:在别人的 Issue 下提问时

Thanks for the report. Could you clarify what you expected to happen here? The current behavior matches the docs, so I want to make sure I understand the use case.

提问的一方也会使用这个表达。这是一种礼貌地确认期望、不具攻击性的方法。

3. 相似表达与区别

4. 韩国人常犯的错误

5. 一行练习

请将以下内容分成 Issue 的两个格子,并用英文书写。

我删除了备份策略,但预定的备份仍在不断创建。我认为删除策略后,预定备份也应该停止。

参考答案

What happened: After deleting the backup policy, scheduled backups are still being created.

What did you expect to happen: Deleting the policy should stop the scheduled backups.

are still being created 是“现在仍在继续被创建”的进行时被动语态。后一句因为表达的是“应该……”的期望,所以使用 should。

Titi 小贴士。 只要把期望的事情和实际发生的事情分成两行来写,Bug 报告就已经完成了一半。

参考

登录后即可点赞

评论

还没有评论。

登录后即可发表评论