首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >黄瓜场景测试潜水日志的REST接口

黄瓜场景测试潜水日志的REST接口
EN

Code Review用户
提问于 2016-12-08 20:46:39
回答 1查看 70关注 0票数 0

我正在寻找如何改进这个黄瓜场景(测试REST接口)并使其更加简洁的想法。

代码语言:javascript
复制
Feature: Get list of Logbooks
    As a client, I want to get a list of a certain users logbooks so that i can present
    the logbooks name and the number of scuba dives to the user.

Scenario: Get a list of logbooks
    Given the system knows about the user "tom"
    And the user has the email "tom@tom.com"
    And he owns the logbooks
      | pacific  |
      | atlantic |
      | gulf     |
    When the client asks the system for a list of logbooks owned by user
    Then the client gets a list with 3 logbooks
    And all logbooks of the list have the users name
    And all logbooks of the list have the users email
    And one logbook has the name
      | pacific  |
      | atlantic |
      | gulf     |
    But if the user has no logbook
    And the client requests a logbook from the system
    Then the client gets an error message

详细信息:客户端(browser/其他服务)通过REST访问日志服务。客户端可以询问系统的用户名和电子邮件地址,询问用户可能存储在系统中的日志列表(名为太平洋、大西洋和海湾)。如果用户没有存储日志,则返回错误消息。

EN

回答 1

Code Review用户

回答已采纳

发布于 2017-02-21 11:41:28

以下是我将如何更新所提供的内容,但下面是一些需要进一步改进的要点。

代码语言:javascript
复制
Feature: Get list of Logbooks
    As a client
    I want to get a list of a certain users logbooks 
    So that i can present the logbooks name and the number of scuba dives to the client.

Background:
    Given the user "tom" has the email "tom@tom.com"

Scenario: Get a list of logbooks
    Given "tom" owns the logbooks:
      | pacific  |
      | atlantic |
      | gulf     |
    When the client requests for a list of logbooks owned by "tom"
    Then the client gets a list with 3 logbooks
    And the requested logbooks should have the users name and email
    And the requested logbooks should have the names:
      | pacific  |
      | atlantic |
      | gulf     |

Scenario: The user has no logbooks
    Given "tom" owns no logbooks
    When the client requests for a list of logbooks owned by "tom"
    Then the client should see the message "tom has no logbooks"

改进

的方法

BDD是关于对话的。

黄瓜是一个BDD工具,意味着它有助于打破业务和开发团队之间的会话障碍。在功能文件完成之前,您应该就开发团队和业务所使用的语言达成一致。

场景中所述的语言是否与业务和开发团队同意使用的语言相同?如果没有,更新语言。(例如And the requested log books should have the users name and email)

有什么额外的步骤是企业想知道的吗?如果是的话,就把它们加进去。

有什么不需要的步骤吗?如果是的话,就把它们移走。

票数 1
EN
页面原文内容由Code Review提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://codereview.stackexchange.com/questions/149343

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档