cucumber jvm

Post on 26-May-2015

898 Views

Category:

Documents

12 Downloads

Preview:

Click to see full reader

TRANSCRIPT

Cucumber-JVM

yunsang.choi@sk.com

13년 6월 11일 화요일

What is Cucumber?

13년 6월 11일 화요일

13년 6월 11일 화요일

13년 6월 11일 화요일

피부에 좋은

오이

Cucumber는

13년 6월 11일 화요일

피부에 좋은

오이

BDD를 위한

Cucumber는

13년 6월 11일 화요일

13년 6월 11일 화요일

13년 6월 11일 화요일

13년 6월 11일 화요일

write features in plain text

13년 6월 11일 화요일

write features in plain text

business readable DSL

13년 6월 11일 화요일

write features in plain text

business readable DSL

documentation+automated tests

13년 6월 11일 화요일

Business facing Technology facingfeatures

scenarios

steps

step definitions

support code

13년 6월 11일 화요일

Business facing Technology facingfeatures

scenarios

steps

step definitions

support code

13년 6월 11일 화요일

Business facing Technology facingfeatures

scenarios

steps

step definitions

support code

13년 6월 11일 화요일

Business facing Technology facingfeatures

scenarios

steps

step definitions

support code

13년 6월 11일 화요일

documentation

automation tests

13년 6월 11일 화요일

Gherkin Basic

13년 6월 11일 화요일

13년 6월 11일 화요일

13년 6월 11일 화요일

피부에 좋은

오이

Gherkin은

13년 6월 11일 화요일

피부에 좋은

오이feature 를 기술하기 위한

Gherkin은

13년 6월 11일 화요일

Gherkin is

13년 6월 11일 화요일

Gherkin is

the language that Cucumber understands

13년 6월 11일 화요일

Gherkin is

Business-readableDomain Specific Language

the language that Cucumber understands

13년 6월 11일 화요일

Gherkin example :

13년 6월 11일 화요일

Gherkin example :

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

13년 6월 11일 화요일

Gherkin example :

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

13년 6월 11일 화요일

Gherkin example :

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

step definitions

13년 6월 11일 화요일

Gherkin : more examples

13년 6월 11일 화요일

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

scenario background

13년 6월 11일 화요일

scenario outline

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

13년 6월 11일 화요일

data table

doc string

13년 6월 11일 화요일

Cucumber 는

문서화기능이 강화된 UnitTest?

UnitTest을 대체할 Testing F/W?

13년 6월 11일 화요일

with UnitTesttest for

13년 6월 11일 화요일

What to do

with UnitTesttest for

13년 6월 11일 화요일

What to do How to do

with UnitTesttest for

13년 6월 11일 화요일

System Behavior

What to do How to do

with UnitTesttest for

13년 6월 11일 화요일

System Behavior Module / Design

What to do How to do

with UnitTesttest for

13년 6월 11일 화요일

System Behavior Module / Design

What to do How to do

with

Specification

UnitTesttest for

13년 6월 11일 화요일

System Behavior Module / Design

What to do How to do

with

Specification Implementation

UnitTesttest for

13년 6월 11일 화요일

System Behavior Module / Design

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

What to do How to do

with

Specification Implementation

UnitTesttest for

13년 6월 11일 화요일

System Behavior Module / Design

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

What to do How to do

with

Specification Implementation

UnitTesttest for

13년 6월 11일 화요일

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

13년 6월 11일 화요일

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

cucumber는 명세레벨 테스팅

unit test는 모듈레벨 테스팅

13년 6월 11일 화요일

Cucumber is the best toolfor ATDD/BDD

13년 6월 11일 화요일

Cucumber is the best toolfor ATDD/BDD

BUT...

13년 6월 11일 화요일

Cucumber is fororiginal

13년 6월 11일 화요일

Cucumber is fororiginal

java 개발자는...

써글 ruby 개발자들

cucumber+rspec쵝오!

13년 6월 11일 화요일

+

Cucumber for Java

13년 6월 11일 화요일

13년 6월 11일 화요일

Aslak Hellesøy & Dan North

13년 6월 11일 화요일

Aslak Hellesøy & Dan North

Cucumber의 전신

13년 6월 11일 화요일

Aslak Hellesøy & Dan North

Cucumber의 전신

더이상 개발되지 않음

13년 6월 11일 화요일

Cuke4Duke

13년 6월 11일 화요일

Cuke4Dukeon

13년 6월 11일 화요일

Cuke4Dukeon

Aslak Hellesøy

13년 6월 11일 화요일

Cuke4Dukeon

Aslak Hellesøy

2년 전 개발 중단

13년 6월 11일 화요일

Cucumber-JVM

13년 6월 11일 화요일

Cucumber-JVM

Aslak Hellesøy

13년 6월 11일 화요일

Cucumber-JVM

Aslak Hellesøy

Cucumber를 Java로 다시 구현

13년 6월 11일 화요일

Cucumber-JVM

Aslak Hellesøy

Cucumber를 Java로 다시 구현

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

13년 6월 11일 화요일

이제 cucumber ruby를 버리는 중?

Cucumber-JVM은 Cucumber의 SubProject

13년 6월 11일 화요일

Cucumber-JVM 설정

13년 6월 11일 화요일

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일 화요일

src/test/java/features/CucumberTests.java

@RunWith(Cucumber.class)

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

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

13년 6월 11일 화요일

src/test/resources/cucumber.xml

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

13년 6월 11일 화요일

src/test/resources/features/*.feature

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

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

13년 6월 11일 화요일

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

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

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

13년 6월 11일 화요일

Cucumber-JVM

step definitions

13년 6월 11일 화요일

scenario

step definition

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

정규식의  matching  group을  parameter로  받음

13년 6월 11일 화요일

scenario

step definition

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

13년 6월 11일 화요일

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

Step Definitions :

13년 6월 11일 화요일

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

13년 6월 11일 화요일

Cucumber Tips

13년 6월 11일 화요일

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

Top 5 Cucumber best practices

13년 6월 11일 화요일

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

Top 5 Cucumber best practices

13년 6월 11일 화요일

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

Top 5 Cucumber best practices

13년 6월 11일 화요일

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

Top 5 Cucumber best practices

13년 6월 11일 화요일

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

Top 5 Cucumber best practices

13년 6월 11일 화요일

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일 화요일

끝ND

13년 6월 11일 화요일

top related