SlideShare una empresa de Scribd logo
1 de 10
Gherkin
G-W-T
Feature: Una persona bilingüe
Scenario:
Given una persona bilingüe
Then habla inglés
Scenario:
Given una persona bilingüe
When se encuentra un americano
Then habla inglés
Siempre debemos incluir un when en la escritura de
nuestros escenarios.
No tiene sentido que comprobemos (Then) algo si no
ocurre nada. (When)
Feature: 2 güiris en Benidorm
Background:
Given: Una persona de habla inglesa
And: está en España de vacaciones
Scenario:
When: Se encuentra un británico
Then: Hablan en inglés
Background:
Given: Una persona de habla inglesa
When: está en España de vacaciones
Scenario:
Given: Se encuentra un británico
Then: Hablan en inglés
Given siempre debe ir delante de when
¿Por qué? No tiene sentido que digamos que algo ha
ocurrido y después presentemos el escenario.
Feature: Bebe y bebe y vuelven a
beber Scenario:
Given Tengo 5 latas de cerveza
When me bebo una cerveza
When me bebo una cerveza
Then tengo 3 cervezas frías
Scenario:
Given Tengo 5 latas de cerveza
When me bebo una cerveza
And me bebo una cerveza
Then tengo 3 cervezas frías
En lugar de usar When,When,When no olvidemos que
podemos usar and
En lenguaje natural no tendría sentido...
Feature: Miedo a volar
Scenario:
Given una persona tiene miedo a volar
When hace un vuelo de Madrid a Nueva York
Then tiene náuseas
Then intenta dormirse para no marearse
Scenario:
Given una persona tiene miedo a volar
When hace un vuelo de Madrid a Nueva York
Then tiene náuseas
And intenta dormirse para no marearse
En lugar de usar Then,Then,Then no olvidemos que
podemos usar and
En lenguaje natural no tendría sentido...
Feature: Tarta para todos
Background:
Given: Tengo 6 pedazos de tarta
Scenario:
Given tengo 5 invitados
Then me queda un pedazo de tarta para mí.
Background:
Given: Tengo 6 pedazos de tarta
Scenario:
Given tengo 5 invitados
When cada invitado se come un pedazo de tarta
Then me queda un pedazo de tarta para mí.
Para comprobar (Then) necesitamos
que ocurra algo (When)
Feature: Tengo mucha sed
Background:
Given: hay una máquina de refrescos
When: tengo sed
Scenario: Estoy a dieta
Then me compro un botellín de agua
Scenario: He tenido una bajada de tensión
Then me compro una coca-cola.
Background:
Given: hay una máquina de refrescos
Scenario: Estoy a dieta
When: tengo sed
Then me compro un botellín de agua
Scenario: He tenido una bajada de tensión
When: tengo sed
Then me compro una coca-cola.
No debemos confundir el background con un repositorio de
cosas comunes. El background lo usamos para presentar el
escenario(Given) pero nunca acciones (when) y mucho menos
evaluaciones (Then)
Feature: El coche nuevo para el jefe
Background:
Given: Tengo 1 coche nuevo y uno viejo
Scenario:
When tengo una avería en el coche nuevo
Then utilizo el coche viejo para desplazarme.
Scenario:
Given mi mujer no tiene coche propio
When mi mujer utiliza el coche nuevo
Then yo utilizo el coche viejo
¡¡¡Este scenario está
perfectamente escrito!!!
Separar el primer Given en 2,
estaría correcto tambien,
quedando algo de este estilo
Given tengo 1 coche nuevo
And tengo 1 coche viejo
Feature: El premio de la lotería
Scenario:
When me toca la lotería
Then me pongo contento
Scenario:
Given tengo un décimo de lotería
When me toca la lotería
Then me pongo contento
Salvo que seas Faustino…. deberías tener un décimo si
quieres que te toque.. Es decir antes de que ocurra algo
(when) debemos presentar el escenario (Given)
Errores comunes en uso de gherkin

Más contenido relacionado

La actualidad más candente

AWS DirectConnect 구성 가이드 (김용우) - 파트너 웨비나 시리즈
AWS DirectConnect 구성 가이드 (김용우) -  파트너 웨비나 시리즈AWS DirectConnect 구성 가이드 (김용우) -  파트너 웨비나 시리즈
AWS DirectConnect 구성 가이드 (김용우) - 파트너 웨비나 시리즈Amazon Web Services Korea
 
AWS IoT로 예지정비 실현하기 - 이종화 솔루션즈 아키텍트, AWS
AWS IoT로 예지정비 실현하기 - 이종화 솔루션즈 아키텍트, AWSAWS IoT로 예지정비 실현하기 - 이종화 솔루션즈 아키텍트, AWS
AWS IoT로 예지정비 실현하기 - 이종화 솔루션즈 아키텍트, AWSAmazon Web Services Korea
 
PHPのセッション管理にDynamoDBを使う
PHPのセッション管理にDynamoDBを使うPHPのセッション管理にDynamoDBを使う
PHPのセッション管理にDynamoDBを使うTaiji INOUE
 
20191126 AWS Black Belt Online Seminar Amazon AppStream 2.0
20191126 AWS Black Belt Online Seminar Amazon AppStream 2.020191126 AWS Black Belt Online Seminar Amazon AppStream 2.0
20191126 AWS Black Belt Online Seminar Amazon AppStream 2.0Amazon Web Services Japan
 
Unleash the Power of Temporary AWS Credentials (a.k.a. IAM roles) (SEC390-R1)...
Unleash the Power of Temporary AWS Credentials (a.k.a. IAM roles) (SEC390-R1)...Unleash the Power of Temporary AWS Credentials (a.k.a. IAM roles) (SEC390-R1)...
Unleash the Power of Temporary AWS Credentials (a.k.a. IAM roles) (SEC390-R1)...Amazon Web Services
 
AWS 클라우드 기반 게임 아키텍처 사례 - AWS Summit Seoul 2017
AWS 클라우드 기반 게임 아키텍처 사례 - AWS Summit Seoul 2017AWS 클라우드 기반 게임 아키텍처 사례 - AWS Summit Seoul 2017
AWS 클라우드 기반 게임 아키텍처 사례 - AWS Summit Seoul 2017Amazon Web Services Korea
 
Cloud Migration 과 Modernization 을 위한 30가지 아이디어-박기흥, AWS Migrations Specialist...
Cloud Migration 과 Modernization 을 위한 30가지 아이디어-박기흥, AWS Migrations Specialist...Cloud Migration 과 Modernization 을 위한 30가지 아이디어-박기흥, AWS Migrations Specialist...
Cloud Migration 과 Modernization 을 위한 30가지 아이디어-박기흥, AWS Migrations Specialist...Amazon Web Services Korea
 
AWS 기반 블록체인 (1부) - 블록체인 환경 구성하기 (박혜영 & 유다니엘, AWS 솔루션즈 아키텍트) :: AWS DevDay2018
AWS 기반 블록체인 (1부) - 블록체인 환경 구성하기 (박혜영 & 유다니엘, AWS 솔루션즈 아키텍트) :: AWS DevDay2018AWS 기반 블록체인 (1부) - 블록체인 환경 구성하기 (박혜영 & 유다니엘, AWS 솔루션즈 아키텍트) :: AWS DevDay2018
AWS 기반 블록체인 (1부) - 블록체인 환경 구성하기 (박혜영 & 유다니엘, AWS 솔루션즈 아키텍트) :: AWS DevDay2018Amazon Web Services Korea
 
AWS Kubernetes 서비스 자세히 살펴보기 (정영준 & 이창수, AWS 솔루션즈 아키텍트) :: AWS DevDay2018
AWS Kubernetes 서비스 자세히 살펴보기 (정영준 & 이창수, AWS 솔루션즈 아키텍트) :: AWS DevDay2018AWS Kubernetes 서비스 자세히 살펴보기 (정영준 & 이창수, AWS 솔루션즈 아키텍트) :: AWS DevDay2018
AWS Kubernetes 서비스 자세히 살펴보기 (정영준 & 이창수, AWS 솔루션즈 아키텍트) :: AWS DevDay2018Amazon Web Services Korea
 
Where is my cache architectural patterns for caching microservices by example
Where is my cache  architectural patterns for caching microservices by exampleWhere is my cache  architectural patterns for caching microservices by example
Where is my cache architectural patterns for caching microservices by exampleRafał Leszko
 
SPA를 AWS Amplify에서 Hosting해 본 경험기
SPA를 AWS Amplify에서 Hosting해 본 경험기SPA를 AWS Amplify에서 Hosting해 본 경험기
SPA를 AWS Amplify에서 Hosting해 본 경험기ChanMin Park
 
Building Trust Between Modern Distributed Systems with SPIFFE
Building Trust Between Modern Distributed Systems with SPIFFEBuilding Trust Between Modern Distributed Systems with SPIFFE
Building Trust Between Modern Distributed Systems with SPIFFEQAware GmbH
 
Secure Virtual Private Cloud(VPC)를 활용한 보안성 강화와 비용절감 - 안경진 부장, 포티넷 코리아 :: AWS ...
Secure Virtual Private Cloud(VPC)를 활용한 보안성 강화와 비용절감 - 안경진 부장, 포티넷 코리아 :: AWS ...Secure Virtual Private Cloud(VPC)를 활용한 보안성 강화와 비용절감 - 안경진 부장, 포티넷 코리아 :: AWS ...
Secure Virtual Private Cloud(VPC)를 활용한 보안성 강화와 비용절감 - 안경진 부장, 포티넷 코리아 :: AWS ...Amazon Web Services Korea
 
AWS re:Invent 2016: Workshop: Secure Your Web Application with AWS WAF and Am...
AWS re:Invent 2016: Workshop: Secure Your Web Application with AWS WAF and Am...AWS re:Invent 2016: Workshop: Secure Your Web Application with AWS WAF and Am...
AWS re:Invent 2016: Workshop: Secure Your Web Application with AWS WAF and Am...Amazon Web Services
 
컨테이너 및 서버리스를 위한 효율적인 CI/CD 아키텍처 구성하기 - 현창훈 데브옵스 엔지니어, Flex / 송주영 데브옵스 엔지니어, W...
컨테이너 및 서버리스를 위한 효율적인 CI/CD 아키텍처 구성하기 - 현창훈 데브옵스 엔지니어, Flex / 송주영 데브옵스 엔지니어, W...컨테이너 및 서버리스를 위한 효율적인 CI/CD 아키텍처 구성하기 - 현창훈 데브옵스 엔지니어, Flex / 송주영 데브옵스 엔지니어, W...
컨테이너 및 서버리스를 위한 효율적인 CI/CD 아키텍처 구성하기 - 현창훈 데브옵스 엔지니어, Flex / 송주영 데브옵스 엔지니어, W...Amazon Web Services Korea
 
Monitor All Your Things: Amazon CloudWatch in Action with BBC (DEV302) - AWS ...
Monitor All Your Things: Amazon CloudWatch in Action with BBC (DEV302) - AWS ...Monitor All Your Things: Amazon CloudWatch in Action with BBC (DEV302) - AWS ...
Monitor All Your Things: Amazon CloudWatch in Action with BBC (DEV302) - AWS ...Amazon Web Services
 
AWS Personalize 중심으로 살펴본 추천 시스템 원리와 구축
AWS Personalize 중심으로 살펴본 추천 시스템 원리와 구축AWS Personalize 중심으로 살펴본 추천 시스템 원리와 구축
AWS Personalize 중심으로 살펴본 추천 시스템 원리와 구축Sungmin Kim
 
AWS 고객이 주로 겪는 운영 이슈에 대한 해법-AWS Summit Seoul 2017
AWS 고객이 주로 겪는 운영 이슈에 대한 해법-AWS Summit Seoul 2017AWS 고객이 주로 겪는 운영 이슈에 대한 해법-AWS Summit Seoul 2017
AWS 고객이 주로 겪는 운영 이슈에 대한 해법-AWS Summit Seoul 2017Amazon Web Services Korea
 
Introduction to Incident Response on AWS
Introduction to Incident Response on AWSIntroduction to Incident Response on AWS
Introduction to Incident Response on AWSAmazon Web Services
 

La actualidad más candente (20)

AWS DirectConnect 구성 가이드 (김용우) - 파트너 웨비나 시리즈
AWS DirectConnect 구성 가이드 (김용우) -  파트너 웨비나 시리즈AWS DirectConnect 구성 가이드 (김용우) -  파트너 웨비나 시리즈
AWS DirectConnect 구성 가이드 (김용우) - 파트너 웨비나 시리즈
 
AWS IoT로 예지정비 실현하기 - 이종화 솔루션즈 아키텍트, AWS
AWS IoT로 예지정비 실현하기 - 이종화 솔루션즈 아키텍트, AWSAWS IoT로 예지정비 실현하기 - 이종화 솔루션즈 아키텍트, AWS
AWS IoT로 예지정비 실현하기 - 이종화 솔루션즈 아키텍트, AWS
 
PHPのセッション管理にDynamoDBを使う
PHPのセッション管理にDynamoDBを使うPHPのセッション管理にDynamoDBを使う
PHPのセッション管理にDynamoDBを使う
 
20191126 AWS Black Belt Online Seminar Amazon AppStream 2.0
20191126 AWS Black Belt Online Seminar Amazon AppStream 2.020191126 AWS Black Belt Online Seminar Amazon AppStream 2.0
20191126 AWS Black Belt Online Seminar Amazon AppStream 2.0
 
Unleash the Power of Temporary AWS Credentials (a.k.a. IAM roles) (SEC390-R1)...
Unleash the Power of Temporary AWS Credentials (a.k.a. IAM roles) (SEC390-R1)...Unleash the Power of Temporary AWS Credentials (a.k.a. IAM roles) (SEC390-R1)...
Unleash the Power of Temporary AWS Credentials (a.k.a. IAM roles) (SEC390-R1)...
 
AWS 클라우드 기반 게임 아키텍처 사례 - AWS Summit Seoul 2017
AWS 클라우드 기반 게임 아키텍처 사례 - AWS Summit Seoul 2017AWS 클라우드 기반 게임 아키텍처 사례 - AWS Summit Seoul 2017
AWS 클라우드 기반 게임 아키텍처 사례 - AWS Summit Seoul 2017
 
Cloud Migration 과 Modernization 을 위한 30가지 아이디어-박기흥, AWS Migrations Specialist...
Cloud Migration 과 Modernization 을 위한 30가지 아이디어-박기흥, AWS Migrations Specialist...Cloud Migration 과 Modernization 을 위한 30가지 아이디어-박기흥, AWS Migrations Specialist...
Cloud Migration 과 Modernization 을 위한 30가지 아이디어-박기흥, AWS Migrations Specialist...
 
AWS 기반 블록체인 (1부) - 블록체인 환경 구성하기 (박혜영 & 유다니엘, AWS 솔루션즈 아키텍트) :: AWS DevDay2018
AWS 기반 블록체인 (1부) - 블록체인 환경 구성하기 (박혜영 & 유다니엘, AWS 솔루션즈 아키텍트) :: AWS DevDay2018AWS 기반 블록체인 (1부) - 블록체인 환경 구성하기 (박혜영 & 유다니엘, AWS 솔루션즈 아키텍트) :: AWS DevDay2018
AWS 기반 블록체인 (1부) - 블록체인 환경 구성하기 (박혜영 & 유다니엘, AWS 솔루션즈 아키텍트) :: AWS DevDay2018
 
AWS Kubernetes 서비스 자세히 살펴보기 (정영준 & 이창수, AWS 솔루션즈 아키텍트) :: AWS DevDay2018
AWS Kubernetes 서비스 자세히 살펴보기 (정영준 & 이창수, AWS 솔루션즈 아키텍트) :: AWS DevDay2018AWS Kubernetes 서비스 자세히 살펴보기 (정영준 & 이창수, AWS 솔루션즈 아키텍트) :: AWS DevDay2018
AWS Kubernetes 서비스 자세히 살펴보기 (정영준 & 이창수, AWS 솔루션즈 아키텍트) :: AWS DevDay2018
 
Where is my cache architectural patterns for caching microservices by example
Where is my cache  architectural patterns for caching microservices by exampleWhere is my cache  architectural patterns for caching microservices by example
Where is my cache architectural patterns for caching microservices by example
 
SPA를 AWS Amplify에서 Hosting해 본 경험기
SPA를 AWS Amplify에서 Hosting해 본 경험기SPA를 AWS Amplify에서 Hosting해 본 경험기
SPA를 AWS Amplify에서 Hosting해 본 경험기
 
Building Trust Between Modern Distributed Systems with SPIFFE
Building Trust Between Modern Distributed Systems with SPIFFEBuilding Trust Between Modern Distributed Systems with SPIFFE
Building Trust Between Modern Distributed Systems with SPIFFE
 
Ansible Automation - Enterprise Use Cases | Juncheng Anthony Lin
Ansible Automation - Enterprise Use Cases | Juncheng Anthony LinAnsible Automation - Enterprise Use Cases | Juncheng Anthony Lin
Ansible Automation - Enterprise Use Cases | Juncheng Anthony Lin
 
Secure Virtual Private Cloud(VPC)를 활용한 보안성 강화와 비용절감 - 안경진 부장, 포티넷 코리아 :: AWS ...
Secure Virtual Private Cloud(VPC)를 활용한 보안성 강화와 비용절감 - 안경진 부장, 포티넷 코리아 :: AWS ...Secure Virtual Private Cloud(VPC)를 활용한 보안성 강화와 비용절감 - 안경진 부장, 포티넷 코리아 :: AWS ...
Secure Virtual Private Cloud(VPC)를 활용한 보안성 강화와 비용절감 - 안경진 부장, 포티넷 코리아 :: AWS ...
 
AWS re:Invent 2016: Workshop: Secure Your Web Application with AWS WAF and Am...
AWS re:Invent 2016: Workshop: Secure Your Web Application with AWS WAF and Am...AWS re:Invent 2016: Workshop: Secure Your Web Application with AWS WAF and Am...
AWS re:Invent 2016: Workshop: Secure Your Web Application with AWS WAF and Am...
 
컨테이너 및 서버리스를 위한 효율적인 CI/CD 아키텍처 구성하기 - 현창훈 데브옵스 엔지니어, Flex / 송주영 데브옵스 엔지니어, W...
컨테이너 및 서버리스를 위한 효율적인 CI/CD 아키텍처 구성하기 - 현창훈 데브옵스 엔지니어, Flex / 송주영 데브옵스 엔지니어, W...컨테이너 및 서버리스를 위한 효율적인 CI/CD 아키텍처 구성하기 - 현창훈 데브옵스 엔지니어, Flex / 송주영 데브옵스 엔지니어, W...
컨테이너 및 서버리스를 위한 효율적인 CI/CD 아키텍처 구성하기 - 현창훈 데브옵스 엔지니어, Flex / 송주영 데브옵스 엔지니어, W...
 
Monitor All Your Things: Amazon CloudWatch in Action with BBC (DEV302) - AWS ...
Monitor All Your Things: Amazon CloudWatch in Action with BBC (DEV302) - AWS ...Monitor All Your Things: Amazon CloudWatch in Action with BBC (DEV302) - AWS ...
Monitor All Your Things: Amazon CloudWatch in Action with BBC (DEV302) - AWS ...
 
AWS Personalize 중심으로 살펴본 추천 시스템 원리와 구축
AWS Personalize 중심으로 살펴본 추천 시스템 원리와 구축AWS Personalize 중심으로 살펴본 추천 시스템 원리와 구축
AWS Personalize 중심으로 살펴본 추천 시스템 원리와 구축
 
AWS 고객이 주로 겪는 운영 이슈에 대한 해법-AWS Summit Seoul 2017
AWS 고객이 주로 겪는 운영 이슈에 대한 해법-AWS Summit Seoul 2017AWS 고객이 주로 겪는 운영 이슈에 대한 해법-AWS Summit Seoul 2017
AWS 고객이 주로 겪는 운영 이슈에 대한 해법-AWS Summit Seoul 2017
 
Introduction to Incident Response on AWS
Introduction to Incident Response on AWSIntroduction to Incident Response on AWS
Introduction to Incident Response on AWS
 

Destacado

Introducción a gherkin
Introducción a gherkinIntroducción a gherkin
Introducción a gherkinwesovi
 
Quality Assurance Guidelines
Quality Assurance GuidelinesQuality Assurance Guidelines
Quality Assurance GuidelinesTim Stribos
 
BDD, Gherkin, Cucumber and why we need it.
BDD, Gherkin, Cucumber and why we need it.BDD, Gherkin, Cucumber and why we need it.
BDD, Gherkin, Cucumber and why we need it.AlexOsadchyy
 
Bdd – with cucumber and gherkin
Bdd – with cucumber and gherkinBdd – with cucumber and gherkin
Bdd – with cucumber and gherkinArati Joshi
 
Gherkin - crash course
Gherkin - crash courseGherkin - crash course
Gherkin - crash courseMichele Costa
 
Ryanair presentation- Future of BDD in Ryanair
Ryanair presentation- Future of BDD in RyanairRyanair presentation- Future of BDD in Ryanair
Ryanair presentation- Future of BDD in RyanairCigniti Technologies Ltd
 
Specification-By-Example with Gherkin
Specification-By-Example with GherkinSpecification-By-Example with Gherkin
Specification-By-Example with GherkinChristian Hassa
 
Ryanair presentation-Use of Gherkin in BDD
Ryanair presentation-Use of Gherkin in BDDRyanair presentation-Use of Gherkin in BDD
Ryanair presentation-Use of Gherkin in BDDCigniti Technologies Ltd
 
Specifications for the real world — Using Specification by Example and Gherkin
Specifications for the real world — Using Specification by Example and GherkinSpecifications for the real world — Using Specification by Example and Gherkin
Specifications for the real world — Using Specification by Example and GherkinKamil Nicieja
 
Gherkin for test automation in agile
Gherkin for test automation in agileGherkin for test automation in agile
Gherkin for test automation in agileViresh Doshi
 
Tutorial: Implementing Specification-By-Example with Gherkin
Tutorial: Implementing Specification-By-Example with GherkinTutorial: Implementing Specification-By-Example with Gherkin
Tutorial: Implementing Specification-By-Example with GherkinChristian Hassa
 
The Art of Gherkin Scripting - Matt Eakin
The Art of Gherkin Scripting - Matt EakinThe Art of Gherkin Scripting - Matt Eakin
The Art of Gherkin Scripting - Matt EakinQA or the Highway
 
SpecFlow and some things I've picked up
SpecFlow and some things I've picked upSpecFlow and some things I've picked up
SpecFlow and some things I've picked upMarcus Hammarberg
 
Software testing and quality assurance
Software testing and quality assuranceSoftware testing and quality assurance
Software testing and quality assuranceBenjamin Baumann
 

Destacado (16)

Introducción a gherkin
Introducción a gherkinIntroducción a gherkin
Introducción a gherkin
 
Quality Assurance Guidelines
Quality Assurance GuidelinesQuality Assurance Guidelines
Quality Assurance Guidelines
 
BDD, Gherkin, Cucumber and why we need it.
BDD, Gherkin, Cucumber and why we need it.BDD, Gherkin, Cucumber and why we need it.
BDD, Gherkin, Cucumber and why we need it.
 
Bdd – with cucumber and gherkin
Bdd – with cucumber and gherkinBdd – with cucumber and gherkin
Bdd – with cucumber and gherkin
 
The Gherkin
The GherkinThe Gherkin
The Gherkin
 
Gherkin - crash course
Gherkin - crash courseGherkin - crash course
Gherkin - crash course
 
Ryanair presentation- Future of BDD in Ryanair
Ryanair presentation- Future of BDD in RyanairRyanair presentation- Future of BDD in Ryanair
Ryanair presentation- Future of BDD in Ryanair
 
Specification-By-Example with Gherkin
Specification-By-Example with GherkinSpecification-By-Example with Gherkin
Specification-By-Example with Gherkin
 
Ryanair presentation-Use of Gherkin in BDD
Ryanair presentation-Use of Gherkin in BDDRyanair presentation-Use of Gherkin in BDD
Ryanair presentation-Use of Gherkin in BDD
 
Cucumber & gherkin language
Cucumber & gherkin languageCucumber & gherkin language
Cucumber & gherkin language
 
Specifications for the real world — Using Specification by Example and Gherkin
Specifications for the real world — Using Specification by Example and GherkinSpecifications for the real world — Using Specification by Example and Gherkin
Specifications for the real world — Using Specification by Example and Gherkin
 
Gherkin for test automation in agile
Gherkin for test automation in agileGherkin for test automation in agile
Gherkin for test automation in agile
 
Tutorial: Implementing Specification-By-Example with Gherkin
Tutorial: Implementing Specification-By-Example with GherkinTutorial: Implementing Specification-By-Example with Gherkin
Tutorial: Implementing Specification-By-Example with Gherkin
 
The Art of Gherkin Scripting - Matt Eakin
The Art of Gherkin Scripting - Matt EakinThe Art of Gherkin Scripting - Matt Eakin
The Art of Gherkin Scripting - Matt Eakin
 
SpecFlow and some things I've picked up
SpecFlow and some things I've picked upSpecFlow and some things I've picked up
SpecFlow and some things I've picked up
 
Software testing and quality assurance
Software testing and quality assuranceSoftware testing and quality assurance
Software testing and quality assurance
 

Errores comunes en uso de gherkin

  • 2. Feature: Una persona bilingüe Scenario: Given una persona bilingüe Then habla inglés Scenario: Given una persona bilingüe When se encuentra un americano Then habla inglés Siempre debemos incluir un when en la escritura de nuestros escenarios. No tiene sentido que comprobemos (Then) algo si no ocurre nada. (When)
  • 3. Feature: 2 güiris en Benidorm Background: Given: Una persona de habla inglesa And: está en España de vacaciones Scenario: When: Se encuentra un británico Then: Hablan en inglés Background: Given: Una persona de habla inglesa When: está en España de vacaciones Scenario: Given: Se encuentra un británico Then: Hablan en inglés Given siempre debe ir delante de when ¿Por qué? No tiene sentido que digamos que algo ha ocurrido y después presentemos el escenario.
  • 4. Feature: Bebe y bebe y vuelven a beber Scenario: Given Tengo 5 latas de cerveza When me bebo una cerveza When me bebo una cerveza Then tengo 3 cervezas frías Scenario: Given Tengo 5 latas de cerveza When me bebo una cerveza And me bebo una cerveza Then tengo 3 cervezas frías En lugar de usar When,When,When no olvidemos que podemos usar and En lenguaje natural no tendría sentido...
  • 5. Feature: Miedo a volar Scenario: Given una persona tiene miedo a volar When hace un vuelo de Madrid a Nueva York Then tiene náuseas Then intenta dormirse para no marearse Scenario: Given una persona tiene miedo a volar When hace un vuelo de Madrid a Nueva York Then tiene náuseas And intenta dormirse para no marearse En lugar de usar Then,Then,Then no olvidemos que podemos usar and En lenguaje natural no tendría sentido...
  • 6. Feature: Tarta para todos Background: Given: Tengo 6 pedazos de tarta Scenario: Given tengo 5 invitados Then me queda un pedazo de tarta para mí. Background: Given: Tengo 6 pedazos de tarta Scenario: Given tengo 5 invitados When cada invitado se come un pedazo de tarta Then me queda un pedazo de tarta para mí. Para comprobar (Then) necesitamos que ocurra algo (When)
  • 7. Feature: Tengo mucha sed Background: Given: hay una máquina de refrescos When: tengo sed Scenario: Estoy a dieta Then me compro un botellín de agua Scenario: He tenido una bajada de tensión Then me compro una coca-cola. Background: Given: hay una máquina de refrescos Scenario: Estoy a dieta When: tengo sed Then me compro un botellín de agua Scenario: He tenido una bajada de tensión When: tengo sed Then me compro una coca-cola. No debemos confundir el background con un repositorio de cosas comunes. El background lo usamos para presentar el escenario(Given) pero nunca acciones (when) y mucho menos evaluaciones (Then)
  • 8. Feature: El coche nuevo para el jefe Background: Given: Tengo 1 coche nuevo y uno viejo Scenario: When tengo una avería en el coche nuevo Then utilizo el coche viejo para desplazarme. Scenario: Given mi mujer no tiene coche propio When mi mujer utiliza el coche nuevo Then yo utilizo el coche viejo ¡¡¡Este scenario está perfectamente escrito!!! Separar el primer Given en 2, estaría correcto tambien, quedando algo de este estilo Given tengo 1 coche nuevo And tengo 1 coche viejo
  • 9. Feature: El premio de la lotería Scenario: When me toca la lotería Then me pongo contento Scenario: Given tengo un décimo de lotería When me toca la lotería Then me pongo contento Salvo que seas Faustino…. deberías tener un décimo si quieres que te toque.. Es decir antes de que ocurra algo (when) debemos presentar el escenario (Given)