82
Cucumber-JVM [email protected] 13611화요일

Cucumber jvm

Embed Size (px)

Citation preview

Page 1: Cucumber jvm

Cucumber-JVM

[email protected]

13년 6월 11일 화요일

Page 2: Cucumber jvm

What is Cucumber?

13년 6월 11일 화요일

Page 3: Cucumber jvm

13년 6월 11일 화요일

Page 4: Cucumber jvm

13년 6월 11일 화요일

Page 5: Cucumber jvm

피부에 좋은

오이

Cucumber는

13년 6월 11일 화요일

Page 6: Cucumber jvm

피부에 좋은

오이

BDD를 위한

Cucumber는

13년 6월 11일 화요일

Page 7: Cucumber jvm

13년 6월 11일 화요일

Page 8: Cucumber jvm

13년 6월 11일 화요일

Page 9: Cucumber jvm

13년 6월 11일 화요일

Page 10: Cucumber jvm

write features in plain text

13년 6월 11일 화요일

Page 11: Cucumber jvm

write features in plain text

business readable DSL

13년 6월 11일 화요일

Page 12: Cucumber jvm

write features in plain text

business readable DSL

documentation+automated tests

13년 6월 11일 화요일

Page 13: Cucumber jvm

Business facing Technology facingfeatures

scenarios

steps

step definitions

support code

13년 6월 11일 화요일

Page 14: Cucumber jvm

Business facing Technology facingfeatures

scenarios

steps

step definitions

support code

13년 6월 11일 화요일

Page 15: Cucumber jvm

Business facing Technology facingfeatures

scenarios

steps

step definitions

support code

13년 6월 11일 화요일

Page 16: Cucumber jvm

Business facing Technology facingfeatures

scenarios

steps

step definitions

support code

13년 6월 11일 화요일

Page 17: Cucumber jvm

documentation

automation tests

13년 6월 11일 화요일

Page 18: Cucumber jvm

Gherkin Basic

13년 6월 11일 화요일

Page 19: Cucumber jvm

13년 6월 11일 화요일

Page 20: Cucumber jvm

13년 6월 11일 화요일

Page 21: Cucumber jvm

피부에 좋은

오이

Gherkin은

13년 6월 11일 화요일

Page 22: Cucumber jvm

피부에 좋은

오이feature 를 기술하기 위한

Gherkin은

13년 6월 11일 화요일

Page 23: Cucumber jvm

Gherkin is

13년 6월 11일 화요일

Page 24: Cucumber jvm

Gherkin is

the language that Cucumber understands

13년 6월 11일 화요일

Page 25: Cucumber jvm

Gherkin is

Business-readableDomain Specific Language

the language that Cucumber understands

13년 6월 11일 화요일

Page 26: Cucumber jvm

Gherkin example :

13년 6월 11일 화요일

Page 27: Cucumber jvm

Gherkin example :

feature 제목 및 설명테스트 실행과는 무관한 문서요소

13년 6월 11일 화요일

Page 28: Cucumber jvm

Gherkin example :

feature를 설명할 다수의 scenario로 구성scenario는 구체적이고 테스트 가능한 예제. 각 scenario는 automated testing으로 실행됨

13년 6월 11일 화요일

Page 29: Cucumber jvm

Gherkin example :

scenario는 여러 step으로 구성.각 step은 정규식으로 매칭되는 step definition의 code를 실행하게 됨

step definitions

13년 6월 11일 화요일

Page 30: Cucumber jvm

Gherkin : more examples

13년 6월 11일 화요일

Page 31: Cucumber jvm

모든 시나리오가 동일한 Given(조건)을 가질 경우 Background 절로 구성함

scenario background

13년 6월 11일 화요일

Page 32: Cucumber jvm

scenario outline

동일한 시나리오로 여러 값들을 테스트할 때 사용내부적으로는 다수의 시나리오처럼 실행함Fit/FitNesse와 유사한 expression

13년 6월 11일 화요일

Page 33: Cucumber jvm

data table

doc string

13년 6월 11일 화요일

Page 34: Cucumber jvm

Cucumber 는

문서화기능이 강화된 UnitTest?

UnitTest을 대체할 Testing F/W?

13년 6월 11일 화요일

Page 35: Cucumber jvm

with UnitTesttest for

13년 6월 11일 화요일

Page 36: Cucumber jvm

What to do

with UnitTesttest for

13년 6월 11일 화요일

Page 37: Cucumber jvm

What to do How to do

with UnitTesttest for

13년 6월 11일 화요일

Page 38: Cucumber jvm

System Behavior

What to do How to do

with UnitTesttest for

13년 6월 11일 화요일

Page 39: Cucumber jvm

System Behavior Module / Design

What to do How to do

with UnitTesttest for

13년 6월 11일 화요일

Page 40: Cucumber jvm

System Behavior Module / Design

What to do How to do

with

Specification

UnitTesttest for

13년 6월 11일 화요일

Page 41: Cucumber jvm

System Behavior Module / Design

What to do How to do

with

Specification Implementation

UnitTesttest for

13년 6월 11일 화요일

Page 42: Cucumber jvm

System Behavior Module / Design

“상수시간 내에 응답해야한다”

What to do How to do

with

Specification Implementation

UnitTesttest for

13년 6월 11일 화요일

Page 43: Cucumber jvm

System Behavior Module / Design

“상수시간 내에 응답해야한다” “Cache는 LRU정책을 따른다”

What to do How to do

with

Specification Implementation

UnitTesttest for

13년 6월 11일 화요일

Page 44: Cucumber jvm

“The Rspec book”, David Chelimskywith Dave Astels,Zach Dennis, Aslak Hellesoy,Bryan Helmkamp,and Dan North

13년 6월 11일 화요일

Page 45: Cucumber jvm

“The Rspec book”, David Chelimskywith Dave Astels,Zach Dennis, Aslak Hellesoy,Bryan Helmkamp,and Dan North

cucumber는 명세레벨 테스팅

unit test는 모듈레벨 테스팅

13년 6월 11일 화요일

Page 46: Cucumber jvm

Cucumber is the best toolfor ATDD/BDD

13년 6월 11일 화요일

Page 47: Cucumber jvm

Cucumber is the best toolfor ATDD/BDD

BUT...

13년 6월 11일 화요일

Page 48: Cucumber jvm

Cucumber is fororiginal

13년 6월 11일 화요일

Page 49: Cucumber jvm

Cucumber is fororiginal

java 개발자는...

써글 ruby 개발자들

cucumber+rspec쵝오!

13년 6월 11일 화요일

Page 50: Cucumber jvm

+

Cucumber for Java

13년 6월 11일 화요일

Page 51: Cucumber jvm

13년 6월 11일 화요일

Page 52: Cucumber jvm

Aslak Hellesøy & Dan North

13년 6월 11일 화요일

Page 53: Cucumber jvm

Aslak Hellesøy & Dan North

Cucumber의 전신

13년 6월 11일 화요일

Page 54: Cucumber jvm

Aslak Hellesøy & Dan North

Cucumber의 전신

더이상 개발되지 않음

13년 6월 11일 화요일

Page 55: Cucumber jvm

Cuke4Duke

13년 6월 11일 화요일

Page 56: Cucumber jvm

Cuke4Dukeon

13년 6월 11일 화요일

Page 57: Cucumber jvm

Cuke4Dukeon

Aslak Hellesøy

13년 6월 11일 화요일

Page 58: Cucumber jvm

Cuke4Dukeon

Aslak Hellesøy

2년 전 개발 중단

13년 6월 11일 화요일

Page 59: Cucumber jvm

Cucumber-JVM

13년 6월 11일 화요일

Page 60: Cucumber jvm

Cucumber-JVM

Aslak Hellesøy

13년 6월 11일 화요일

Page 61: Cucumber jvm

Cucumber-JVM

Aslak Hellesøy

Cucumber를 Java로 다시 구현

13년 6월 11일 화요일

Page 62: Cucumber jvm

Cucumber-JVM

Aslak Hellesøy

Cucumber를 Java로 다시 구현

JVM 상의 주요언어들을 모두 지원

13년 6월 11일 화요일

Page 63: Cucumber jvm

이제 cucumber ruby를 버리는 중?

Cucumber-JVM은 Cucumber의 SubProject

13년 6월 11일 화요일

Page 64: Cucumber jvm

Cucumber-JVM 설정

13년 6월 11일 화요일

Page 65: Cucumber jvm

pom.xml 에 dependency 추가

junit과 연동

java를 쓸 경우 필수

spring F/W과 연동

주의) junit은 4.11 이상을 쓸것 (junit 4.8에서 오류 있음)주의) cucumber-jvm 최신은 1.1.3이지만, pretty formatter 이슈가 있어서 1.1.2를

사용

13년 6월 11일 화요일

Page 66: Cucumber jvm

src/test/java/features/CucumberTests.java

@RunWith(Cucumber.class)

JUnit Runner로 Cucumber test가 실행될 수 있도록 함@Cucumber.Options(...)

Cucumber의 실행옵션feature 파일 위치와 출력형식을 지정

13년 6월 11일 화요일

Page 67: Cucumber jvm

src/test/resources/cucumber.xml

cucumber-­‐spring 을 사용할 경우 반드시 있어야 함cucumber test를 실행할 때 필요한 spring configuration을 설정한다.

13년 6월 11일 화요일

Page 68: Cucumber jvm

src/test/resources/features/*.feature

feature 파일은 일반 plain text 이므로 test/resources 밑에 놓는다.

다른 junit test와 분리될 수 있도록 features 라는 package를 사용.

13년 6월 11일 화요일

Page 69: Cucumber jvm

src/test/java/features/step_definitions/*.java

step definitions는 java 클래스이므로 test/java/ 밑에 구성다른 테스트 클래스와 구별되도록 features.step_definitions 패키지

밑에 step definition 클래스를 구성한다.

13년 6월 11일 화요일

Page 70: Cucumber jvm

Cucumber-JVM

step definitions

13년 6월 11일 화요일

Page 71: Cucumber jvm

scenario

step definition

step  텍스트에  대한  정규식을  Annotation(@Given,  @When,  @Then)으로  기술

정규식의  matching  group을  parameter로  받음

13년 6월 11일 화요일

Page 72: Cucumber jvm

scenario

step definition

기본  type에  대해서는  arguments의  type  변환을  지원함

13년 6월 11일 화요일

Page 73: Cucumber jvm

http://cukes.info/step-­‐definitions.html

Step Definitions :

13년 6월 11일 화요일

Page 74: Cucumber jvm

Demohttps://github.com/odd-poet/cucumber-sample

13년 6월 11일 화요일

Page 75: Cucumber jvm

Cucumber Tips

13년 6월 11일 화요일

Page 76: Cucumber jvm

http://blog.codeship.io/2013/05/21/Testing-Tuesday-6-Top-5-Cucumber-best-practices.html

Top 5 Cucumber best practices

13년 6월 11일 화요일

Page 77: Cucumber jvm

http://blog.codeship.io/2013/05/21/Testing-Tuesday-6-Top-5-Cucumber-best-practices.html

Top 5 Cucumber best practices

13년 6월 11일 화요일

Page 78: Cucumber jvm

http://blog.codeship.io/2013/05/21/Testing-Tuesday-6-Top-5-Cucumber-best-practices.html

Top 5 Cucumber best practices

13년 6월 11일 화요일

Page 79: Cucumber jvm

http://blog.codeship.io/2013/05/21/Testing-Tuesday-6-Top-5-Cucumber-best-practices.html

Top 5 Cucumber best practices

13년 6월 11일 화요일

Page 80: Cucumber jvm

http://blog.codeship.io/2013/05/21/Testing-Tuesday-6-Top-5-Cucumber-best-practices.html

Top 5 Cucumber best practices

13년 6월 11일 화요일

Page 81: Cucumber jvm

Refining specification

• Examples should be precise and testable• Scripts are not specifications• Don’t create flow-like descriptions

• Specifications should be about business functionality, not software design• Avoid writing specifications that are tightly coupled with code

• Don’t get trapped in user interface details • Specifications should be self-explanatory• Specifications should be focused• Specifications should be in domain language

“Specification by Example”, Gojko Adjic

13년 6월 11일 화요일

Page 82: Cucumber jvm

끝ND

13년 6월 11일 화요일