Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/ssl/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Bdd 创建有意义的用户故事_Bdd_Specflow_Acceptance Testing_Gherkin - Fatal编程技术网

Bdd 创建有意义的用户故事

Bdd 创建有意义的用户故事,bdd,specflow,acceptance-testing,gherkin,Bdd,Specflow,Acceptance Testing,Gherkin,我们正在尝试使用BDD创建一个web服务,向网页提供数据,然后保存用户的更改 到目前为止,我的故事是这样的 Given I want the data for order number 1234 When I load the data Then I have the data for order number 1234 我的方法缺少什么? 用户故事不适合这种任务吗? 我如何制定有意义的用户故事 [更新] As a customer I want to see my order So tha

我们正在尝试使用BDD创建一个web服务,向网页提供数据,然后保存用户的更改

到目前为止,我的故事是这样的

Given I want the data for order number  1234
When I load the data
Then I have the data for order number 1234
我的方法缺少什么? 用户故事不适合这种任务吗? 我如何制定有意义的用户故事

[更新]

As a customer
I want to see my order
So that I can check it is what I expect

Given I have entered the order number
When I Click GO
Then I should see my order displayed on the screen

以下是我如何写下你迄今为止所拥有的:

Feature:
  As a customer
  I want to be able to view and change my orders
  So that I can check that they're being processed as I expect and deal with them if they're not

  Scenario:
    Given I am a customer
    And I have an order
    When I go to the order
    Then I should see the order
(我的工具似乎希望我缩进黄瓜,这就是我使用的缩进方式,但这并不重要。)

以下至少是我以这种方式重写它的一些原因:

  • 通常情况下,与同一产品功能(本例中为订单管理)相关的多个场景位于同一功能文件中,因此功能部分的范围应比单个场景更广。也许这个功能甚至应该包括在第一位下订单
  • 给定的
    s是场景发生之前的真实情况,比如客户和订单的存在。场景中的操作属于
    When
    s
  • 最好避免像“单击”和特定按钮名称以及“显示在屏幕上”这样的UI细节。场景应该关注行为。进入订单时的
    步骤可以封装进入屏幕输入号码、输入号码和单击按钮的详细信息
  • 同样地,应该可见的订单不同字段的所有检查都可以封装在
    中,然后我应该可以看到订单
  • 我说的是“订单”而不是“我的订单”,因为
    和我有一个订单
    确定了一个订单与场景之间的特殊关系,最好在所有场景中建立一种语言来明确这种关系——在这种情况下,我总是使用“订单”。(这是一个很小的问题。)
考虑到这些风格点,这是一个不错的场景,我当然写过很多类似的场景。然而,为了回答你真正的问题:

Specflow类型工具真正的亮点是当您使用它们尽可能完整地描述用例/用户故事时。例如:

  Scenario:
    Given I am a customer
    And there is a product

    When I go to the product page
    Then I should see the product

    When I add the product to my cart
    And I check out
    Then I should see that the order has been placed
    And I should receive an order confirmation email

    When I go to my orders
    Then I should see the order listed

    When I go to the order
    Then I should see the order

    When I cancel the order
    Then I should see that the order has been cancelled
    And I should receive an order cancellation email

    When I go to my orders
    Then I should not see the order listed

这作为验收测试更有价值,因为它捕获了更多的需求,作为集成测试更强大,因为它使用了更多的系统,伪造的更少。(在简短的场景中,我们必须人工创建订单。这里我们通过系统来完成。)

我不太了解您的系统,无法写出真正的答案,但您的场景看起来不像是从用户的角度描述系统——它更像是一个单元测试(其他工具更适合哪个)。用户如何与系统交互?场景应该可以描述这一点。@DaveSchweisguth,谢谢Dave我更新了这个问题……但它看起来仍然很琐碎。我还应该做什么?也许我可以列出我应该在屏幕上看到的元素。。。我应该看到订单行项目和发货地址,以及何时发货。我很喜欢这个用工作故事代替用户故事的博客。