How the Gherkin language bridges the gap between customers and developers

原文英文,约700词,阅读约需3分钟。发表于:

How the Gherkin language bridges the gap between customers and developers David Blackwood Tue, 02/07/2023 - 03:00 Communicating with software developers can often be a burdensome task, especially when people lack technical knowledge and technical vocabulary. This is why project managers often use user stories and the versatile system metaphor. You can assist communication further by utilizing technology designed to facilitate discussions between a project's stakeholders and developers. The Cucumber framework Cucumber is an open source framework that enables the creation of automated software tests using an easy-to-write and common language. It's based on the concept of behavior-driven development (BDD), which dictates that creating software should define how a user wants an application to behave when specific conditions are true. The Cucumber framework isn't "technology" in the modern sense. It's not a collection of bits and bytes. Instead, it's a way of writing in natural language (English, in the case of this article, but so far Gherkin has been translated to over 70 languages). When using the Cucumber framework, you aren't expected to know how to read or write code. You only need to be able to write down ideas you have about how you work. You should also document how you want technology to work for you, using a set of specific terms and guidelines. What is the Gherkin language? Cucumber uses Gherkin as a means to define use cases. It's primarily used to generate unambiguous project requirements. In other words, its purpose is to allow users to describe precisely what they require software to do, leaving no room for interpretation or exception. It helps you think through the process of a transaction with technology and then helps you write it down in a form that translates into programmer logic. Here's an example: 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 returnedAs you can see, this is a highly specific scenario in which an imaginary user requests £50, and the ATM provides £50 and adjusts the user's account balance accordingly. This scenario is just one part of an ATM's purpose, and it only represents a specific component of a person's interaction with a cash machine. When a programmer is given the task to program the machine to respond to a user request, this clearly demonstrates what factors are involved. What are Gherkin keywords? The Gherkin syntax makes use of five indispensable statements describing the actions needed to perform a task: Feature: denotes a high-level description of any given software function Scenario: describes a concrete example Given: explains the initial context of the system When: specifies an event or action Then: describes an expected outcome, or a result And (or but): increases text fluidity By making use of these simple keywords, customers, analysts, testers, and software programmers are empowered to exchange ideas with terminology that's recognizable by all. More DevOps resources What is DevOps? The ultimate DevOps hiring guide DevOps monitoring tools guide A guide to implementing DevSecOps Download the DevOps glossary eBook: Ansible for DevOps Latest DevOps articles Executable requirements and automated testing Even better, Gherkin requirements are also executable. This is done by mapping each and every keyword to its intended (and clearly stated) functionality. So, to keep with the example above, anything already implemented could automatically be displayed in green: 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 By extension, Gherkin enables developers to translate requirements into testable code. In practice, you can use specific phrases to check in on your software solutions! If your current code isn't working properly, or a new change has accidentally caused a software error (or two or three) then you can easily pinpoint problems before proceeding to repair them. Conclusion Thanks to the Gherkin syntax, your customers will no longer be in a pickle. You can bridge the divide between businesses and developers and deliver outstanding products with greater confidence than ever before. Find out more about Gherkin by visiting the Cucumber website or its Git repository. The Gherkin syntax helps you think through the process of a transaction with technology and then helps you write it down in a form that translates into programmer logic. Image by: Melissa Hogan, CC BY-SA 4.0, via Wikimedia Commons DevOps What to read next This work is licensed under a Creative Commons Attribution-Share Alike 4.0 International License. Register or Login to post a comment.

使用Cucumber框架可以使用简单易懂的语言创建自动化软件测试,它基于行为驱动开发(BDD)的概念,无需了解代码,只需要把想法写下来,用特定的术语和准则记录下如何使用技术。Gherkin语言可以用来定义用例,它主要用于生成明确的项目要求,使用五个关键词:Feature、Scenario、Given、When、Then和And(或But),可以让客户、分析师、测试人员和软件程序员用共同的术语交流。Gherkin要求也是可执行的,可以将每个关键词映射到其预期的功能,从而帮助开发人员将要求转换为可测试的代码。使用Gherkin语法,可以消除业务和开发人员之间的差距,更加自信地提

How the Gherkin language bridges the gap between customers and developers
相关推荐 去reddit讨论