This repository has been archived by the owner on Apr 9, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 576
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
2 changed files
with
91 additions
and
91 deletions.
There are no files selected for viewing
91 changes: 0 additions & 91 deletions
91
...⭐️ How the Gherkin language bridges the gap between customers and developers.md
This file was deleted.
Oops, something went wrong.
91 changes: 91 additions & 0 deletions
91
...⭐️ How the Gherkin language bridges the gap between customers and developers.md
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,91 @@ | ||
[#]: subject: "How the Gherkin language bridges the gap between customers and developers" | ||
[#]: via: "https://opensource.com/article/23/2/gherkin-language-developers" | ||
[#]: author: "David Blackwood https://opensource.com/users/david-blackwood" | ||
[#]: collector: "lkxed" | ||
[#]: translator: "geekpi" | ||
[#]: reviewer: " " | ||
[#]: publisher: " " | ||
[#]: url: " " | ||
|
||
Gherkin 语言如何弥合客户和开发人员之间的差距 | ||
====== | ||
|
||
与软件开发人员沟通通常是一项繁重的任务,尤其是当人们缺乏技术知识和技术词汇时。这就是为什么项目经理经常使用[用户故事][1]和多功能系统隐喻。 | ||
|
||
你可以利用旨在促进项目利益相关者和开发人员之间讨论的技术,进一步协助沟通。 | ||
|
||
### Cucumber 框架 | ||
|
||
Cucumber 是一个开源框架,可以使用易于编写的通用语言创建自动化软件测试。它基于[行为驱动开发 (BDD)][2] 的概念,该概念规定创建软件应定义用户希望应用在特定条件成立时如何表现。 | ||
|
||
Cucumber 框架并不是现代意义上的“技术”。它不是位和字节的集合。相反,它是一种用自然语言(在本文中为英语,但到目前为止 Gherkin 已被翻译成 70 多种语言)的写作方式。使用 Cucumber 框架时,你不需要知道如何读取或编写代码。你只需要能够写下你对工作方式的想法即可。你还应该使用一组特定术语和指南来记录你希望技术如何为你服务。 | ||
|
||
### Gherkin 语言是什么? | ||
|
||
Cucumber 使用 Gherkin 作为定义用例的方法。它主要用于生成明确的项目需求。换句话说,其目的是允许用户准确地描述他们需要软件做什么,不留任何解释或例外的空间。它帮助你思考技术事务的过程,然后帮助你以可转化为程序员逻辑的形式将其写下来。 | ||
|
||
这是一个例子: | ||
|
||
``` | ||
Feature: The Current Account Holder withdraws money | ||
Scenario: The account in question is not lacking in funds | ||
Given that the account balance is £200 | ||
And the debit card is valid | ||
And the cash machine contains enough money | ||
When the Current Account Holder requests £50 | ||
Then the cash machine dispenses £50 | ||
And the account balance is £150 | ||
And the debit card is returned | ||
``` | ||
|
||
正如你所看到的,这是一个非常具体的场景,其中假设用户请求 50 英镑,ATM 提供 50 英镑并相应地调整用户的帐户余额。此场景只是 ATM 用途的一部分,它仅代表人与提款机交互的特定组成部分。当程序员被赋予对机器进行编程以响应用户请求的任务时,这清楚地表明了涉及哪些因素。 | ||
|
||
#### Gherkin 关键字是什么? | ||
|
||
Gherkin 语法使用五个不可或缺的语句来描述执行任务所需的操作: | ||
|
||
- **Feature**:表示任何给定软件功能的高层次描述 | ||
- **Scenario**:描述具体_示例_ | ||
- **Given**:解释系统的初始上下文 | ||
- **When**:指定事件或操作 | ||
- **Then**:描述预期输出或结果 | ||
- **And (或者 but)**:增加文本流畅性 | ||
|
||
通过使用这些简单的关键字,客户、分析师、测试人员和软件程序员能够使用所有人都能识别的术语来交换想法。 | ||
|
||
### 可执行的需求和自动化测试 | ||
|
||
更好的是,_Gherkin 要求也是可执行的_。这是通过将每个关键字映射到其预期(且明确说明)的功能来完成的。因此,为了与上面的示例保持一致,任何已经实现的内容都可以自动显示为绿色: | ||
|
||
``` | ||
When the Current Account Holder requests £50* | ||
Then the cash machine dispenses £50* | ||
And the account balance is £150 | ||
And the debit card is returned | ||
``` | ||
|
||
通过扩展,Gherkin 使开发人员能够将需求转换为可测试的代码。在实践中,你可以使用特定的短语来检查你的软件方案! 如果你当前的代码无法正常工作,或者新的更改意外导致软件错误(或两个或三个),那么你可以轻松查明问题,然后再继续修复它们。 | ||
|
||
### 结论 | ||
|
||
得益于 Gherkin 语法,你的客户将不再陷入困境。你可以弥合企业和开发人员之间的鸿沟,并比以往更有信心地交付出色的产品。 | ||
|
||
通过访问 [Cucumber 网站][3]或其 [Git 仓库][4]了解有关 Gherkin 的更多信息。 | ||
|
||
-------------------------------------------------------------------------------- | ||
|
||
via: https://opensource.com/article/23/2/gherkin-language-developers | ||
|
||
作者:[David Blackwood][a] | ||
选题:[lkxed][b] | ||
译者:[geekpi](https://github.com/geekpi) | ||
校对:[校对者ID](https://github.com/校对者ID) | ||
|
||
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 | ||
|
||
[a]: https://opensource.com/users/david-blackwood | ||
[b]: https://github.com/lkxed/ | ||
[1]: https://softwareplanetgroup.co.uk/user-stories-bridging-the-gap-between-customers-and-developers-updated/ | ||
[2]: https://opensource.com/article/19/2/behavior-driven-development-tools | ||
[3]: https://cucumber.io/docs/gherkin/ | ||
[4]: https://github.com/cucumber/docs |