gpt4 book ai didi

cucumber - 在 BDD 用户故事/验收测试中混合那时和何时

转载 作者:行者123 更新时间:2023-12-04 06:47:51 26 4
gpt4 key购买 nike

你如何处理像这样的长链的用户故事/验收测试,然后/何时混合在一起?是否最好将其拆分为单独的验收测试,其中一个测试对话框出现,然后第二个测试对话框显示后的行为?

Feature: Confirmation before removing products from cart
In order to avoid accidentally removing an item from my cart
As a Customer
I want a confirmation dialog to ask me if I'm sure I want to remove an item

Scenario: I want to remove an item from my cart
Given I have added item "xyz" to my cart
When I click "Remove"
Then a confirmation dialog pops up
And it asks "Are you sure you want to remove this from your cart"
When I click "Yes"
Then item "xyz" should be removed from my cart

最佳答案

您的方案似乎有点长,并且与 gui 密切相关。如果您将其与系统的功能联系起来,会发生什么?

Scenario: I want to remove an item from my cart
Given I have a cart containing "xyz"
When I remove "xyz" from my cart
Then my cart should be empty.

该场景现在描述了对用户有用的东西,并且更容易重构。

我和我一样喜欢 BDD,因为我遇到过这样的情况。我们进行了 120 次验收测试,但大部分都失败了。有人像你描述的那样放入了一个确认对话框,并立即通过了 80 多个验收测试。通过将它们变成具有高级、可重用步骤的场景,我们可以轻松地重构并保持测试工作,即使我们用于实现系统功能的机制发生变化。按钮的实际点击发生在那些可重用的步骤中,每个步骤可以有多个 UI 操作。

我在这里写了一个场景,如果它有用的话会这样做(它是 DSL 而不是英语,但你应该明白这个想法):

http://code.google.com/p/wipflash/source/browse/Example.PetShop.Scenarios/PetRegistrationAndPurchase.cs

关于cucumber - 在 BDD 用户故事/验收测试中混合那时和何时,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/3517346/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com