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
130
0
Share
Embed
Copy iframe code
Copy JS code
Copy link
Start on current slide
TDD/BDD
Test-Driven Development
Shintaro Kaneko
October 23, 2014
More Decks by Shintaro Kaneko
See All by Shintaro Kaneko
How to keep growing SRE team at Eureka
kaneshin
3
9.7k
Go - CLI Tools Design
kaneshin
0
7k
Summer Internship 2018 - The principle of the eureka summer internship 2018
kaneshin
2
130
Summer Internship 2018 - The eureka summer internship 2018
kaneshin
0
140
Summer Internship 2018 - How to develop a product
kaneshin
0
120
How to write Go code
kaneshin
8
8.5k
Go Package Guidelines
kaneshin
1
1.2k
net/http package ~GoConference 2017 Spring~
kaneshin
1
3k
Essentials of Golang
kaneshin
5
14k
Other Decks in Programming
See All in Programming
GitHub Copilot CLIのいいところ
htkym
2
1.3k
Dataformのリポジトリを立ち上げるときにまずやること / dataform-day0-2026
snhryt
0
110
Agentic UI
manfredsteyer
PRO
0
110
肥大化するレガシーコードに立ち向かうためのインターフェース分離と依存の逆転 / JJUG CCC 2026 Spring
hirokunimaeta
0
500
コンテキストの使い捨てをやめる — ビジネスルール駆動開発と miko —
ioki
0
140
New "Type" system on PicoRuby
pocke
1
480
ADKを使って簡単にAIエージェントを作ってみよう
k1mu21
0
240
TypeSpec で繋ぐ複数プロダクトの型安全
maroon8021
1
420
脅威をエンジニアリングの糧にして――現場編 / Turning Threats into Engineering Fuel — Field Edition
nrslib
0
250
The NotImplementedError Problem in Ruby
koic
1
620
CSC307 Lecture 17
javiergs
PRO
0
320
柔軟なPDFレイアウトエディタを支える型システム設計 — Discriminated UnionとConditional Typeの実践
minako__ph
4
1.4k
Featured
See All Featured
Faster Mobile Websites
deanohume
310
31k
The Art of Programming - Codeland 2020
erikaheidi
57
14k
Balancing Empowerment & Direction
lara
6
1.1k
DBのスキルで生き残る技術 - AI時代におけるテーブル設計の勘所
soudai
PRO
65
55k
Music & Morning Musume
bryan
47
7.2k
Discover your Explorer Soul
emna__ayadi
2
1.1k
Facilitating Awesome Meetings
lara
57
6.9k
How to Create Impact in a Changing Tech Landscape [PerfNow 2023]
tammyeverts
55
3.4k
The Director’s Chair: Orchestrating AI for Truly Effective Learning
tmiket
1
190
Design in an AI World
tapps
1
220
My Coaching Mixtape
mlcsv
0
140
The AI Revolution Will Not Be Monopolized: How open-source beats economies of scale, even for LLMs
inesmontani
PRO
3
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