- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
我对人们用 Gherkin 语言编写语句来描述为验收测试执行的各种操作的方式感到有点困惑。
在某些文章中人们使用“I”,而在某些文章中人们使用“User”。
react (Then
) 语句的情况也是如此:
Case 1 --> xyz page should be displayed
Case 2 --> xyz page is displayed
Ex 1:
Given statement abc
When user performs action A
Then screen xyz should be displayed
Ex 2:
Given statement abc
When I perform action A
Then screen xyz is displayed
写“用户”还是“我”更好,写“应该是”还是"is"更好,以便我的 BDD 场景能够按照标准呈现和正确?
对任何文章的引用也会有很大帮助。提前致谢。
最佳答案
两者都是正确的,并且有不同的好处。
BDD 的发明者 Dan North 表示,他更喜欢第一人称(“我”),因为这让他能够设身处地为用户着想。然而,他经常使用第三人称(“他/她/顾客”),就像他在 his introductory article 中所做的那样。 .
第一人称使用有助于使场景符合标准故事模板:
As <a stakeholder>
I want <something>
So that <goal>.
如果利益相关者是用户,那么在场景中再次使用“I”是有意义的。
但是,有时场景的结果并不真正有利于用户。
As the moderator of the site
I want users to prove that they're human
So that I can limit spam.
在这种情况下,将场景放在用户的角度来看会很奇怪,因为用户并不真正想要填写验证码框。我们可能会在这里使用第三人。
Given an odd-looking number "31" on a door frame
When the user identifies the number as "31"
Then the system should authenticate them as being human.
您可能还会发现,您有多个利益相关者,其结果很重要。在这种情况下,将场景放在第三人身上可以帮助发现可能未包括在内的任何其他结果或重要利益相关者。
Given Suzanne searches for a taxi for 4pm to take her to hospital
And the estimated price is $23
When she books the taxi
Then she should get a confirmation email
And the driver should be notified of the trip
And she should be charged $23.
因为苏珊娜、司机和 Uber 都参与了这个场景,所以将他们放在第三人中更有意义。
我倾向于更喜欢第三人称,特别是对于具有很多场景的大型产品,因为我发现切换第一人称角色很令人困惑,而且它可以保持一致性。这还意味着您可以为场景中的 Actor 起好记的名字,并更轻松地谈论他们(例如,“克拉伦斯·笨拙输入错误的电话号码”)。
但是,请记住,当您与利益相关者交谈以了解这些场景时,最重要的是对话。尽可能接近地写下他们的话,只有当你使用小 cucumber 重新措辞时,才会对语言做出妥协。
关于cucumber - 我应该在 Gherkin/Specflow Give/When/Then 语句中使用什么人物和情绪?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/34839651/
在 Visual Studio 中,当我输入特征文件时,如果该步骤尚不存在,它会突出显示。我想知道是否有可以在命令行中为 specflow 项目编写的命令,它可以为我提供已存在的所有步骤的列表? 最佳
场景大纲对于创建数据驱动的测试非常方便,但是场景的数量会随着示例的数量而增加。我已经养成了标记场景的习惯,以便更容易过滤我们应用程序的主要功能。 我想设置一个适用于所有主要用例的“冒烟测试”。其中一些
有没有办法用“显式”属性标记 Specflow 测试?我知道可以通过使用特殊标签@ignore 用“忽略”属性标记测试。 最佳答案 也许。 如果您查看生成的 xxx.feature.cs,您会看到它被
简而言之,我需要的是创建一个具有可重复步骤的场景大纲,而不必像我目前在下面所做的那样使用多个 AND 输入它: Scenario Outline: outline Given I am a u
如何在表格中传递空格? Background: Given the following books |Author |(here several spaces)
我有一个如下所示的 Specflow 场景 Scenario: I Shoot a gun When I pull the trigger Then It should expel a bullet
我想在 SpecFlow 功能中添加一些评论。 我收到以下错误: Custom tool error: Parsing error near '/*' 我尝试过以下方法: // comment /*
我从Techtalk了解到将步骤定义与特征耦合是一种反模式。不过,我想知道如何组织我的步骤定义,以便我可以在代码中轻松查看哪些步骤是一起进行的。 例如,我应该为每个功能创建一个代码文件,并为共享的步骤
我正在重构我们的 SpecFlow 实现的 BDD 测试。作为这项工作的一部分,我注释掉了大部分步骤定义。 当我运行测试时,我看到“未找到一个或多个步骤的匹配步骤定义”。消息。 但是,我不想等到测试实
如何配置 SpecFlow,使其不将计时信息显示为测试文本的一部分,例如 -> done: Steps.ThenIWillBeDeniedAccess() (0.0s) 干杯。贾斯。 最佳答案 结果我
我正在使用 SpecFlow 进行一些 BDD 式测试。我的一些功能是 UI 测试,所以他们使用 WatiN。有些不是 UI 测试,所以它们不是。 目前,我有一个 StepDefinitions.cs
我正在使用 SpecFlow,我想编写如下所示的场景: Scenario: Pressing add with an empty stack throws an exception Given
我的项目非常大,并且有大量的测试步骤。结果,当我编写“功能”文件时,我发现我的计算机停止了运转。在非常大的功能文件上,即使不输入任何内容,我的一个 CPU 内核也会最大化,并且性能会下降到输入非常滞后
如果您运行足够多次,我的 SpecFlow 测试会失败。如何进行现有的 SpecFlow 测试并使其运行无限次直到失败? (理想情况下,我想计算需要多少次。) 我最初的猜测是只调用测试脚本最终调用的绑
我已经编写了我希望在运行 specflow 测试之前执行的代码,以设置所有测试都需要的各种全局变量: namespace MyProject.IntegrationTest { public
我尝试使用 Specflow 编写一些功能。不幸的是,通过以下 URL 安装后,我无法在系统中的任何地方找到 techtalk.specflow.dll。 http://visualstudiogal
这是我们的验收测试之一的示例: Feature: Add an effect to a level In order to create a configuration As a user I wan
在我的功能文件中,IntelliSense 说有一个关键字叫 Scenarios .注意是复数。我已经倾注了documentation并且找不到任何对它的引用。任何人都可以解释它的用途以及如何使用它?
我们在我当前的项目中使用了 Specflow 和 WatIn 进行验收测试。客户希望我们改用 Microsoft coded-ui。我从未测试过编码的 ui,但从我目前看到的情况来看,它看起来很麻烦。
我希望能够在本地执行给定的 SpecFlow (Gherkin) .feature 文件,而无需进行编译。 因此工作流程将是(作为业务分析师或 QA 工程师): 1.修改.feature文件(使用预定
我是一名优秀的程序员,十分优秀!