[kr-dev] Cucumber and Javascript #introduce

in #kr-dev7 years ago (edited)



C u c u m b e r
:: #introduce ::

회사에서 자동화 테스트에 Cucumber를 도입하기로 했습니다.
시나리오 작성에 한글도 지원하기 때문에 무려 한글로 시나리오를 작성하는 법을 사용해보려고 합니다.

[ Cucumber가 궁금한 분은 여기로 👉https://docs.cucumber.io/guides/overview/ ]

간단히 말하자면 BDD를 서포트하는 툴입니다.

Scenario: Breaker guesses a word
  Given the Maker has chosen a word
  When the Breaker makes a guess
  Then the Maker is asked to score

이런식으로 작성할 수 있습니다.

Cucumber는 Gherkin이라는 문법으로 작성합니다.
(https://github.com/cucumber/cucumber/wiki/Gherkin)
Gherkin은 70개의 언어를 지원합니다. (심지어 이모지도 지원)
한글로는 아래와 같이 대응합니다.

영어한글이모지
Feature기능📚
Background배경💤
Scenario시나리오📕
Scenario Outline시나리오 개요📖
Examples📓
Given조건, 먼저😐
When만일, 만약🎬
Then그러면🙏
And그리고😂
But하지만, 😔

위 feature는 아래와 같이 한글로 작성될 수 있습니다.

시나리오: Breaker guesses a word
  조건 the Maker has chosen a word
  만약 the Breaker makes a guess
  그러면 the Maker is asked to score

전체를 한글로 시나리오를 작성하는 것도 가능합니다.

시나리오: 고양이를 그린다
  먼저 동그라미를 그린다
  그리고 세모를 그린다
  그러면 고양이가 그려 졌다

간단하죠?

정말 쉬워보이지만 state 관리 등을 생각하면 점점 어려워집니다.
큐컴버를 통해 자동화 테스팅 과정을 한번 연재해볼 예정입니다.