Bdd 给出了自动电子邮件通知的时间场景

Bdd 给出了自动电子邮件通知的时间场景,bdd,gherkin,user-stories,Bdd,Gherkin,User Stories,在特定状态更改后的一个工作日内必须发送通知的电子邮件通知场景中,您将如何编写给定的when-then构造 这个看起来对吗 Given that I'm the system and the user of a particular type T and the state is S When it is 1 business day after the date state was changed to x then send an email notification with xx

在特定状态更改后的一个工作日内必须发送通知的电子邮件通知场景中,您将如何编写给定的when-then构造

这个看起来对吗

Given that I'm the system 
  and the user of a particular type T
  and the state is S
When it is 1 business day after the date state was changed to x
then send an email notification with xxx content.
我有疑问的原因是,我的理解是,在这种情况下,给定的先决条件是a。特定类型的用户,B。状态是S和C。状态更改日期是a之后的1天

如果所有这些先决条件都在给定的部分中,那么when部分将是什么?我的理解是,“何时”部分用于事件触发器。除了运行通知作业外,没有其他操作。那么这是正确的吗

Given the user of a particular type T
  and the state is S
  and it is 1 business day after the date state was changed to x
When the email notification process triggered
  then send an email notification to all users of type T with xxx content.

我很感激你的想法

你走上了正确的道路

正如你之前所说,当是一个触发器时,让我们更深入地研究一下

小黄瓜用于行为驱动开发(BDD),因为您试图模拟行为

给定-输入-先决条件

这些都是在动作或触发发生之前所需要的东西。他们为将要发生的操作设置了测试

何时-触发-动作

这些是触发结果的用户行为。这是BDD中的B

然后-输出-结果

这就是最终结果,当行为完成时,用户应该期望什么

你站在哪里

所以你的处境很有趣,因为正如你所指出的,没有行为。所以这里有一个棘手的部分,虽然有一个给定的When-Then格式很好,但是在没有可靠的用户行为的情况下,有一个给定的When-Then或When-Then格式也是完全有效的。因此,在这种情况下:

Given it is 1 business day after the date state was changed to x

两者同等有效

关于您的第二个代码块,您需要问自己的问题是
触发的电子邮件通知过程
是触发还是结果?我个人认为这是投入的结果。如果您确实认为您需要它,那么我认为您应该这样编写测试:

Given there is a user of type T
And the state is S
And it is 1 business day after the date state was changed to x
Then the email notification process should have triggered
And send an email notification to all users of type T with xxx content.
奖金——如何使用测试词汇和避免使用实现语言

不是你要求的,但实际上有一种方法可以改进你的测试措辞。您希望将测试与实际实现分离。这意味着避免使用诸如“发送”、“单击”或“键入”之类的词语,而是关注行为和结果。参加你的考试,我会这样改写:

Given there is a user of type T
And the state is S
And it is 1 business day after the date state was changed to x
Then all users of type T should be notified of xxx

我删除了电子邮件通知步骤,因为这可以从上一步推断出来。我还将最后一步与实现语言分离。这里重要的不是用户收到一封电子邮件,而是通知他们内容。我认为,给定的
步骤也应该根据您的业务逻辑进行更改,因为它们当前与您的实现非常耦合

你在正确的轨道上

正如你之前所说,当
是一个触发器时,让我们更深入地研究一下

小黄瓜用于行为驱动开发(BDD),因为您试图模拟行为

给定-输入-先决条件

这些都是在动作或触发发生之前所需要的东西。他们为将要发生的操作设置了测试

何时-触发-动作

这些是触发结果的用户行为。这是BDD中的B

然后-输出-结果

这就是最终结果,当行为完成时,用户应该期望什么

你站在哪里

所以你的处境很有趣,因为正如你所指出的,没有行为。所以这里有一个棘手的部分,虽然有一个给定的When-Then格式很好,但是在没有可靠的用户行为的情况下,有一个给定的When-Then或When-Then格式也是完全有效的。因此,在这种情况下:

Given it is 1 business day after the date state was changed to x

两者同等有效

关于您的第二个代码块,您需要问自己的问题是
触发的电子邮件通知过程
是触发还是结果?我个人认为这是投入的结果。如果您确实认为您需要它,那么我认为您应该这样编写测试:

Given there is a user of type T
And the state is S
And it is 1 business day after the date state was changed to x
Then the email notification process should have triggered
And send an email notification to all users of type T with xxx content.
奖金——如何使用测试词汇和避免使用实现语言

不是你要求的,但实际上有一种方法可以改进你的测试措辞。您希望将测试与实际实现分离。这意味着避免使用诸如“发送”、“单击”或“键入”之类的词语,而是关注行为和结果。参加你的考试,我会这样改写:

Given there is a user of type T
And the state is S
And it is 1 business day after the date state was changed to x
Then all users of type T should be notified of xxx

我删除了电子邮件通知步骤,因为这可以从上一步推断出来。我还将最后一步与实现语言分离。这里重要的不是用户收到一封电子邮件,而是通知他们内容。我认为,给定的
步骤也应该根据您的业务逻辑进行更改,因为它们当前与您的实现非常耦合

这是一个多么令人惊讶和启发性的答案。我认为给定的Then方法是完全合理的。这是我的第一个想法,但我想确保我忠于这个构想。奖金部分是一个很大的帮助。公平地说,目标是使行为与实现脱钩吗?在您的代码片段中,用户将被“通知xxx”(行为),但如何部分丢失(通过电子邮件)。作为编写验收标准的人,在我看来,先决条件、行动和结果是必需的,但如何部分(通过电子邮件)也是必需的。假设有一个T型用户,状态为S,状态更改为x后的1个工作日内,所有T型用户应在一天结束时通过电子邮件通知xxx,您必须做适合您ACs的事情,在我的团队中,我通常会尽可能地尝试解耦,因为如果Im