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 Workshop - UIKonf 2016
Search
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
410
BDD NL
paweldudek
0
270
BDD Bialystok/Wroclaw
paweldudek
0
190
Poznan TDD Workshop Part 1
paweldudek
0
85
Behaviour Driven Development - Mobile Trends
paweldudek
1
370
BDD Mobilization
paweldudek
0
130
Behaviour Driven Development - the whys and hows
paweldudek
0
180
Custom Collection View Layouts
paweldudek
0
89
Other Decks in Programming
See All in Programming
Dataformのリポジトリを立ち上げるときにまずやること / dataform-day0-2026
snhryt
0
120
TypeScript+Orvalで実現する型安全かつ堅牢でスケーラブルなマルチチャネル通知基盤 / TSKaigi Night talks ~after conference~
d0riven
0
310
Webフレームワークの ベンチマークについて
yusukebe
0
140
AI時代のUIはどこへ行く?その2!
yusukebe
19
6.8k
作って学ぶ、 JSX (TSX) ランタイムの基本
syumai
7
1.6k
GitHub Copilot CLIのいいところ
htkym
2
1.3k
脅威をエンジニアリングの糧にして――現場編 / Turning Threats into Engineering Fuel — Field Edition
nrslib
0
260
AIで効率化できた業務・日常
ochtum
0
110
ユニットテストの先へ:テスト技法で要求・仕様を整理するJava開発実践 / Beyond_Unit_Testing_Practical_Java_Development_Techniques_for_Organizing_Requirements_and_Specifications
shimashima35
0
370
Swiftのレキシカルスコープ管理
kntkymt
0
220
New "Type" system on PicoRuby
pocke
1
620
TSKaigi Night Talks 2026_TypeScriptでサプライチェーンの整合性を型に閉じ込める
geekplus_tech
0
320
Featured
See All Featured
Design and Strategy: How to Deal with People Who Don’t "Get" Design
morganepeng
133
19k
How To Stay Up To Date on Web Technology
chriscoyier
790
250k
Digital Ethics as a Driver of Design Innovation
axbom
PRO
1
300
Deep Space Network (abreviated)
tonyrice
0
170
"I'm Feeling Lucky" - Building Great Search Experiences for Today's Users (#IAC19)
danielanewman
231
23k
How People are Using Generative and Agentic AI to Supercharge Their Products, Projects, Services and Value Streams Today
helenjbeal
1
200
Money Talks: Using Revenue to Get Sh*t Done
nikkihalliwell
0
240
Max Prin - Stacking Signals: How International SEO Comes Together (And Falls Apart)
techseoconnect
PRO
0
180
Digital Projects Gone Horribly Wrong (And the UX Pros Who Still Save the Day) - Dean Schuster
uxyall
0
1.6k
ピンチをチャンスに:未来をつくるプロダクトロードマップ #pmconf2020
aki_iinuma
128
55k
Jamie Indigo - Trashchat’s Guide to Black Boxes: Technical SEO Tactics for LLMs
techseoconnect
PRO
0
160
BBQ
matthewcrist
89
10k
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!