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 Workshop - UIKonf 2016
Search
Sponsored
·
SiteGround - Reliable hosting with speed, security, and support you can count on.
→
Pawel Dudek
May 25, 2016
Programming
270
0
Share
Embed
Copy iframe code
Copy JS code
Copy link
Start on current slide
TDD Workshop - UIKonf 2016
Pawel Dudek
May 25, 2016
More Decks by Pawel Dudek
See All by Pawel Dudek
Swift Mocks
paweldudek
0
230
BDD DEVit
paweldudek
0
430
BDD NL
paweldudek
0
270
BDD Bialystok/Wroclaw
paweldudek
0
200
Poznan TDD Workshop Part 1
paweldudek
0
89
Behaviour Driven Development - Mobile Trends
paweldudek
1
390
BDD Mobilization
paweldudek
0
130
Behaviour Driven Development - the whys and hows
paweldudek
0
200
Custom Collection View Layouts
paweldudek
0
96
Other Decks in Programming
See All in Programming
WebMCP Challenge に星空観察アプリで参加した話
okajun35
0
130
GKE で Pod の見方を変えたら、スケールアウト時の挙動を真に捉えられた話
stkk
0
110
個人開発基盤をまるごとCloudflareに引っ越して爆速で総合的体験を向上させた話
tinykitten
0
150
高専キャリア LT 発表内容
crysta1221
6
5.6k
20260914 AIエージェント時代のPlatform Engineering LLM基盤とプロダクトの責務境界線
kanfab1
2
280
Family mrubyの進捗
kishima
1
110
Swift愛好会と私(ウホーイ) / Swift Fan Club and Uhooi
uhooi
0
150
テストを司るデーモンに会いに行く 〜隔離した仮想マシンでテストを通すまで〜
h1d3mun3
1
130
【高い買い物LT会】初任給で話題の国産フィジカルAIを買った話
akagami
PRO
0
140
Vibes Containers 〜AIで変わるコンテナ設計と運用〜
tkikuc
3
520
デプロイ直後のレイテンシスパイクを調べたら、 Railsの仕様にたどり着いた
nhsykym
0
110
The Past, Present, and Future of Enterprise Java
ivargrimstad
0
210
Featured
See All Featured
Future Trends and Review - Lecture 12 - Web Technologies (1019888BNR)
signer
PRO
0
3.7k
The Art of Delivering Value - GDevCon NA Keynote
reverentgeek
16
2.2k
First, design no harm
axbom
PRO
2
1.3k
Making Projects Easy
brettharned
120
6.7k
Noah Learner - AI + Me: how we built a GSC Bulk Export data pipeline
techseoconnect
PRO
0
430
Marketing to machines
jonoalderson
1
5.8k
How Fast Is Fast Enough? [PerfNow 2025]
tammyeverts
3
880
Facilitating Awesome Meetings
lara
57
7.1k
It's Worth the Effort
3n
188
29k
WCS-LA-2024
lcolladotor
0
820
The SEO identity crisis: Don't let AI make you average
varn
0
550
Google's AI Overviews - The New Search
badams
0
1.6k
Transcript
Test Driven Development
Why do we need tests?
Preserving behaviors
We're just humans
Failsafe
Test Driven Development
Tests drive the way you code
Always write test first
Tests influence architecture of your app
Tests tell you whether your design became too complex
Have to simulate behavior of your dependency dependency dependency?
Need to fake seven objects?
Need to call five functions to simulate a behavior?
Hard to specify clear requirements?
Overcomplicated design
Thinked-through design
First consumer of your API
Programs must be written for people to read, and only
incidentally for machines to execute. — Harold Abelson
There is no such thing as untestable behavior Only untestable
code
What is testable code?
Good Architecture == Testable code
What is good architecture?
Cohesion
Coupling
Good design A simple definition
High cohesion and low coupling
Easily composable and context independent
Good architecture - base rules » Single responsibility » Few
dependencies » Depend on interfaces, not classes (yay POP!)
None
!!!
http://www.martinfowler.com/ bliki/ DesignStaminaHypothesis.html
SOLID
SOLID Homework » Goruco 2009 - SOLID Object-Oriented Design -
Sandi Metz » MCE^3 - Software Paradigms & Patterns — Did We Get It All Wrong? - Jon Reid » MCE^3 - Jorge Ortiz » Clean Architecture - Uncle Bob
What is BDD
Behavior Driven Development Test Driven Development
What's the difference?
BDD aims to improve certain aspect of TDD
BDD tries to help you know what to test
When writing tests don’t think ‘tests’
Think about ‘behaviors’
Think about examples how your object should behave
An objects behavior is defined by methods it declares in
its interface
You should not be testing internal implementation of your object
Only its interface
Work outside-in
Ubiquitous language
Quick & Nimble
class DolphinSpec: QuickSpec { override func spec() { it("is friendly")
{ expect(Dolphin().isFriendly).to(beTruthy()) } it("is smart") { expect(Dolphin().isSmart).to(beTruthy()) } } }
describe("a dolphin") { describe("its click") { it("is loud") { let
click = Dolphin().click() expect(click.isLoud).to(beTruthy()) } it("has a high frequency") { let click = Dolphin().click() expect(click.hasHighFrequency).to(beTruthy()) } } }
describe("a dolphin") { var dolphin: Dolphin! beforeEach { dolphin =
Dolphin() } describe("its click") { var click: Click! beforeEach { click = dolphin.click() } it("is loud") { expect(click.isLoud).to(beTruthy()) } it("has a high frequency") { expect(click.hasHighFrequency).to(beTruthy()) } } }
describe("its click") { context("when the dolphin is not near anything
interesting") { it("is only emitted once") { expect(dolphin!.click().count).to(equal(1)) } } context("when the dolphin is near something interesting") { beforeEach { let ship = SunkenShip() Jamaica.dolphinCove.add(ship) Jamaica.dolphinCove.add(dolphin) } it("is emitted three times") { expect(dolphin.click().count).to(equal(3)) } } }
That's about it! Let's dive into code!
Assignment 0 » Add data parsing in ChatMessagesUpdater
Assignment 1 » Pass data from model object to table
view cell
That's all folks!