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.1k
Go - CLI Tools Design
kaneshin
0
6.8k
Summer Internship 2018 - The principle of the eureka summer internship 2018
kaneshin
2
97
Summer Internship 2018 - The eureka summer internship 2018
kaneshin
0
90
Summer Internship 2018 - How to develop a product
kaneshin
0
71
How to write Go code
kaneshin
8
8.1k
Go Package Guidelines
kaneshin
1
1.1k
net/http package ~GoConference 2017 Spring~
kaneshin
1
2.7k
Essentials of Golang
kaneshin
5
13k
Other Decks in Programming
See All in Programming
Rubyで始める関数型ドメインモデリング
shogo_tksk
0
130
昭和の職場からアジャイルの世界へ
kumagoro95
1
420
Introduction to kotlinx.rpc
arawn
0
750
コミュニティ駆動 AWS CDK ライブラリ「Open Constructs Library」 / community-cdk-library
gotok365
2
220
ナレッジイネイブリングにAIを活用してみる ゆるSRE勉強会 #9
nealle
0
130
AIの力でお手軽Chrome拡張機能作り
taiseiue
0
190
第3回 Snowflake 中部ユーザ会- dbt × Snowflake ハンズオン
hoto17296
4
390
一休.com のログイン体験を支える技術 〜Web Components x Vue.js 活用事例と最適化について〜
atsumim
0
810
GitHub Actions × RAGでコードレビューの検証の結果
sho_000
0
290
責務と認知負荷を整える! 抽象レベルを意識した関心の分離
yahiru
8
1.3k
CI改善もDatadogとともに
taumu
0
180
PHPのバージョンアップ時にも役立ったAST
matsuo_atsushi
0
210
Featured
See All Featured
Statistics for Hackers
jakevdp
797
220k
Reflections from 52 weeks, 52 projects
jeffersonlam
348
20k
GitHub's CSS Performance
jonrohan
1030
460k
Documentation Writing (for coders)
carmenintech
67
4.6k
XXLCSS - How to scale CSS and keep your sanity
sugarenia
248
1.3M
Product Roadmaps are Hard
iamctodd
PRO
50
11k
実際に使うSQLの書き方 徹底解説 / pgcon21j-tutorial
soudai
175
52k
jQuery: Nuts, Bolts and Bling
dougneiner
63
7.7k
Automating Front-end Workflow
addyosmani
1368
200k
Fontdeck: Realign not Redesign
paulrobertlloyd
83
5.4k
Cheating the UX When There Is Nothing More to Optimize - PixelPioneers
stephaniewalter
280
13k
[RailsConf 2023 Opening Keynote] The Magic of Rails
eileencodes
28
9.3k
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