Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Features
Speaker Deck
PRO
Sign in
Sign up for free
Search
Search
TDD/BDD
Search
Shintaro Kaneko
October 23, 2014
Programming
0
120
TDD/BDD
Test-Driven Development
Shintaro Kaneko
October 23, 2014
Tweet
Share
More Decks by Shintaro Kaneko
See All by Shintaro Kaneko
How to keep growing SRE team at Eureka
kaneshin
3
9.3k
Go - CLI Tools Design
kaneshin
0
6.9k
Summer Internship 2018 - The principle of the eureka summer internship 2018
kaneshin
2
110
Summer Internship 2018 - The eureka summer internship 2018
kaneshin
0
100
Summer Internship 2018 - How to develop a product
kaneshin
0
86
How to write Go code
kaneshin
8
8.2k
Go Package Guidelines
kaneshin
1
1.1k
net/http package ~GoConference 2017 Spring~
kaneshin
1
2.8k
Essentials of Golang
kaneshin
5
14k
Other Decks in Programming
See All in Programming
PostgreSQLのRow Level SecurityをPHPのORMで扱う Eloquent vs Doctrine #phpcon #track2
77web
2
550
ペアプロ × 生成AI 現場での実践と課題について / generative-ai-in-pair-programming
codmoninc
2
20k
Android 16KBページサイズ対応をはじめからていねいに
mine2424
0
200
dbt民主化とLLMによる開発ブースト ~ AI Readyな分析サイクルを目指して ~
yoshyum
3
1.1k
なんとなくわかった気になるブロックテーマ入門/contents.nagoya 2025 6.28
chiilog
1
280
The Modern View Layer Rails Deserves: A Vision For 2025 And Beyond @ RailsConf 2025, Philadelphia, PA
marcoroth
2
640
Claude Code + Container Use と Cursor で作る ローカル並列開発環境のススメ / ccc local dev
kaelaela
11
6.5k
Deep Dive into ~/.claude/projects
hiragram
14
7.2k
PHPでWebSocketサーバーを実装しよう2025
kubotak
0
300
LT 2025-06-30: プロダクトエンジニアの役割
yamamotok
0
800
Composerが「依存解決」のためにどんな工夫をしているか #phpcon
o0h
PRO
1
320
『自分のデータだけ見せたい!』を叶える──Laravel × Casbin で複雑権限をスッキリ解きほぐす 25 分
akitotsukahara
2
650
Featured
See All Featured
The Straight Up "How To Draw Better" Workshop
denniskardys
235
140k
Building a Modern Day E-commerce SEO Strategy
aleyda
42
7.4k
"I'm Feeling Lucky" - Building Great Search Experiences for Today's Users (#IAC19)
danielanewman
229
22k
GraphQLの誤解/rethinking-graphql
sonatard
71
11k
Faster Mobile Websites
deanohume
307
31k
実際に使うSQLの書き方 徹底解説 / pgcon21j-tutorial
soudai
PRO
181
54k
RailsConf 2023
tenderlove
30
1.1k
A designer walks into a library…
pauljervisheath
207
24k
Building Flexible Design Systems
yeseniaperezcruz
328
39k
CSS Pre-Processors: Stylus, Less & Sass
bermonpainter
357
30k
Refactoring Trust on Your Teams (GOTO; Chicago 2020)
rmw
34
3.1k
Docker and Python
trallard
44
3.5k
Transcript
TDD / BDD Introducing with Objective-C using XCTest © kaneshin,
2014 1
Agenda 4 What is TDD? 4 TDD life-cycle 4 How
to play TDD? (Demo) 4 What is BDD? 4 What is the difference between BDD and TDD? 4 How to manipulate BDD? (Demo) © kaneshin, 2014 2
What is TDD? © kaneshin, 2014 3
TDD means Test-Driven Development. 4 Ensure your source code. 4
Understand the feature's specification/s and requirement/s. 4 Easily to adopt Agile for your project. 4 ... © kaneshin, 2014 4
TDD is NOT about testing. 4 TDD is about Development.
4 It's all about expressing intent. 4 Specifically, improving your project. 4 Covering unit tests powerfully. © kaneshin, 2014 5
TDD life-cycle © kaneshin, 2014 6
1. Write a test (Test-First) 2. Run the test (Should
be FAILED) 3. Write code (Make the test pass) 4. Run all tests 5. Refactor (Clean up code) Repeat © kaneshin, 2014 7
1. Write a test and confirm failure 2. Write code
to pass all tests 3. Clean up code Repeat © kaneshin, 2014 8
For example Just Adding Calculator Add A to B ©
kaneshin, 2014 9
Write a test. - (void)testAdd3To4 { Calc *calc = [Calc
new]; XCTAssertEqualWithAccuracy( [calc add:3 to:4], 7, .001 ); } 4 Should be failed on build because there is no implementation. © kaneshin, 2014 10
Write code @interface Calc : NSObject - (double)add:(double)a to:(double)b; @end
@implementation Calc - (double)add:(double)a to:(double)b { return 0.; } @end © kaneshin, 2014 11
Make the test pass @implementation Calc - (double)add:(double)a to:(double)b {
return 7.; } @end 4 Just enough code to pass. © kaneshin, 2014 12
Refine the code @implementation Calc - (double)add:(double)a to:(double)b { return
a + b; } @end 4 Run all tests. © kaneshin, 2014 13
Got it? 4 Memorize the figure 4 Test-First 4 Should
be failed 4 Refactor, Refactor, Refactor © kaneshin, 2014 14
How to play TDD? Demo (Japanese) © kaneshin, 2014 15
Wizard Role-Play ຐ๏͍ͷϩʔϧϓϨΠ © kaneshin, 2014 16
Wizard Spec (ຐ๏͍) 4 Level 1 : ௨ৗ߈ܸ͕Ͱ͖Δ (Attack: 1
Damage) 4 Level 3 : Ϊϥ͕͑Δ (Sizz: 2 Damage) 4 Level 5 : ϝϥϛ͕͑Δ (Frizzle: 2 Damage) 4 Level up ʹExp 30͕ҰͰඞཁ (؆ศͷͨΊ) © kaneshin, 2014 17
Slime Spec (εϥΠϜ) 4 Life: 2, Exp: 10 Goblin Spec
(ΰϒϦϯ) 4 Life: 5, Exp: 30 ※ϞϯελʔҰܦݧΛऔಘ͞ΕΔͱExp0ͱͳΔ © kaneshin, 2014 18
What is BDD? © kaneshin, 2014 19
BDD means Behavior-Driven Development. 4 Basically, it is based on
TDD. © kaneshin, 2014 20
What is the difference between BDD and TDD? © kaneshin,
2014 21
The difference between BDD and TDD? 4 TDD is focused
How on code. 4 Just satisfied spec/s and requirement/s. 4 We wanna confirm a state transition. 4 A State is transitioning every-time. 4 Test-suites might have scenes on conditions. 4 BDD can check the validity of scenes. © kaneshin, 2014 22
How to manipulate BDD? Demo (Japanese) © kaneshin, 2014 23
Thanks © kaneshin, 2014 24