Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Sign up for free
Menu
Search
Features
All features
Private URLs
Password Protection
Custom URLS
Scheduled publishing
Remove Branding
Restrict embedding
Deck Collections
Notes
Features
All features
Private URLs
Password Protection
Custom URLS
Scheduled publishing
Remove Branding
Restrict embedding
Deck Collections
Notes
Explore
Featured decks
Featured speakers
Programming
Technology
Storyboards
Explore
Featured decks
Featured speakers
Programming
Technology
Storyboards
Pricing
Search
Sign in
Sign up for free
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
Transcript
24 slides
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
More Decks by Shintaro Kaneko
See All by Shintaro Kaneko
How to keep growing SRE team at Eureka
kaneshin
3
9.9k
Go - CLI Tools Design
kaneshin
0
7.1k
Summer Internship 2018 - The principle of the eureka summer internship 2018
kaneshin
2
150
Summer Internship 2018 - The eureka summer internship 2018
kaneshin
0
160
Summer Internship 2018 - How to develop a product
kaneshin
0
140
How to write Go code
kaneshin
8
8.6k
Go Package Guidelines
kaneshin
1
1.2k
net/http package ~GoConference 2017 Spring~
kaneshin
1
3.1k
Essentials of Golang
kaneshin
5
14k
Other Decks in Programming
See All in Programming
Web3Dライブラリを作ってVue Custom Rendererの仕組みを理解しよう / lets learn vue custom renderer by making 3d library
drumath2237
1
130
Materialが消えた日 〜真っ白なFlutterキャンバスにRenderObjectで絵を描く〜
umigishiaoi
0
160
Kawaiicon: Kubernetes, it's no longer cool, but let's secure it anyway!
barnbarn
0
130
Vapor Mode でアクセシビリティは 壊れないか検証した話
fuqda
1
340
高橋メソッドでCVE解説シリーズ 〜CVE-2026-112816〜
hakkadaikon
0
250
Herb in Rails 8.2: Your ERB views, now HTML-aware @ Kaigi on Rails 2026, Tokyo, Japan
marcoroth
2
430
あなたの await、OS まで届いてる? strace で覗く JavaScript の非同期
hasutosasaki
1
2.3k
社内AIエージェント「Askワンバン」における コストチューニングの取り組み
t0yohei
0
170
Snowflake Openflow Connector利用の勘所 / 20261024developersio2026tokyo-snowflake-openflow
kasacchiful
PRO
0
330
Long Living Tokens, Die, Die, Die! (or: The One Ring is Banned in Modern)
sylph01
0
420
우리의 Nitro Modules는 당신의 Turbo Modules보다 아름답다
l2hyunwoo
0
260
クラウドエージェントは、 何がそんなに便利なのか / what makes cloud agents so useful
rkaga
5
840
Featured
See All Featured
Efficient Content Optimization with Google Search Console & Apps Script
katarinadahlin
PRO
1
980
世界の人気アプリ100個を分析して見えたペイウォール設計の心得
akihiro_kokubo
PRO
74
43k
The Mindset for Success: Future Career Progression
greggifford
PRO
0
560
Designing Experiences People Love
moore
143
24k
What the history of the web can teach us about the future of AI
inesmontani
PRO
3
800
The Director’s Chair: Orchestrating AI for Truly Effective Learning
tmiket
1
350
Stop Working from a Prison Cell
hatefulcrawdad
274
21k
Leveraging Curiosity to Care for An Aging Population
cassininazir
1
560
Ecommerce SEO: The Keys for Success Now & Beyond - #SERPConf2024
aleyda
1
2.2k
Chasing Engaging Ingredients in Design
codingconduct
0
390
Introduction to Domain-Driven Design and Collaborative software design
baasie
1
1.1k
The Illustrated Guide to Node.js - THAT Conference 2024
reverentgeek
1
600