我正在寻找如何改进这个黄瓜场景(测试REST接口)并使其更加简洁的想法。
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访问日志服务。客户端可以询问系统的用户名和电子邮件地址,询问用户可能存储在系统中的日志列表(名为太平洋、大西洋和海湾)。如果用户没有存储日志,则返回错误消息。
发布于 2017-02-21 11:41:28
以下是我将如何更新所提供的内容,但下面是一些需要进一步改进的要点。
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)
有什么额外的步骤是企业想知道的吗?如果是的话,就把它们加进去。
有什么不需要的步骤吗?如果是的话,就把它们移走。
https://codereview.stackexchange.com/questions/149343
复制相似问题