[Gherkin] Gherkin 거킨이란?

오늘 아침 회의시간에 동료로 부터 Gherkin에 대한 질문을 받았다. 일단 이게 뭔지 몰라서 단어를 검색했는데 검색결과는 온통

오이피클..


Pickled cucumber

Description

A pickled cucumber is a cucumber that has been pickled in a brine, vinegar, or other solution and left to ferment for a period of time, by either immersing the cucumbers in an acidic solution or through souring by lacto-fermentation. Pickled cucumbers are often part of mixed pickles. Wikipedia

미국 캐나다에서는 절인 오이를 피클이라고 하지만, 영국이나 유럽권에서는 거킨(gherkin)이라고 부른다 카더라(...)

AppOps팀에서 뜬금없이 피클에 대해 물어볼리는 없으니

검색을 좀더 해보던중에



cucumber.io에서 Gherkin에 대해 자세히 풀어놨더라

Gherkin Reference

Gherkin uses a set of special keywords to give structure and meaning to executable specifications. Each keyword is translated to many spoken languages; in this reference we’ll use English.
Most lines in a Gherkin document start with one of the keywords.
Comment lines are allowed anywhere in the file. They begin with zero or more spaces, followed by a hash sign (#) and some text. Comments do have to start on a new line.
Either spaces or tabs may be used for indentation. The recommended indentation level is two spaces. Here is an example:
Feature: Guess the word

  # The first example has two steps
  Scenario: Maker starts a game
    When the Maker starts a game
    Then the Maker waits for a Breaker to join

  # The second example has three steps
  Scenario: Breaker joins a game
    Given the Maker has started a game with the word "silky"
    When the Breaker joins the Maker's game
    Then the Breaker must guess a word with 5 characters
The trailing portion (after the keyword) of each step is matched to a code block, called a step definition.


대체 이게 회의시간에 언급된건가 알아보니

PivotalTracker에 Icebox나 Backlog에 들어가는 story description을 Gherkin Syntax를 따라 쓰기 때문이었다. 그냥 Plain text일줄 알았는데..


그래서 일단 Gherkin이 무엇인지 검색을 해보니


Gherkin is the format for cucumber specifications. It is a domain special language which helps you to describe business behaviour without the need to go into detail of implementation. This text acts as documentation and skeleton of your automate tests.
Gherkin is based on TreeTop Grammar which exists in 37+ languages.

Therefore you can write your gherkin in 37+ spoken languages.

This script serves two primary purpose:
1. Documents user scenarios
2. Writing an automated test (BDD)

일단 나는 cucumber로 테스팅따윌 해본적이 없다! 이름만 대충 들어봤지 실제로 접해본적이 없으니 Gherkin까지 알리가 없었다. 
Gherkin은 일종의 Business behaviour, User story/scenario 등을 우리가 쓰는 자연어 natural language로 쓰게 하되(이를테면 영어) 대신 특정의 포맷을 정해둔 규칙같은 것이다. 
Business behaviour 뿐만 아니라 오토메잇 테스팅에도 쓸수 있기도 하다 (애초에 cucumber랑 세트로 나오는게 이때문)

우리팀은 거킨을 테스팅용도로 사용하지 않고, 유저시나리오 용으로 쓰고있다. 



오늘도 새로운것을 알아간다. 


reference: https://www.guru99.com/gherkin-test-cucumber.html
reference: https://cucumber.io/docs/gherkin/

Comments

Popular Posts