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
Pawel Dudek
May 25, 2016
Programming
290
0
Share
Embed
Copy iframe code
Copy JS code
Copy link
Start on current slide
TDD Workshop - UIKonf 2016
Pawel Dudek
May 25, 2016
Transcript
54 slides
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!
More Decks by Pawel Dudek
See All by Pawel Dudek
Swift Mocks
paweldudek
0
250
BDD DEVit
paweldudek
0
440
BDD NL
paweldudek
0
280
BDD Bialystok/Wroclaw
paweldudek
0
210
Poznan TDD Workshop Part 1
paweldudek
0
96
Behaviour Driven Development - Mobile Trends
paweldudek
1
400
BDD Mobilization
paweldudek
0
140
Behaviour Driven Development - the whys and hows
paweldudek
0
210
Custom Collection View Layouts
paweldudek
0
100
Other Decks in Programming
See All in Programming
AI駆動開発4年目の現在地(『あなたはFDEになるべきか?』イベント資料)
kumaiu
0
680
[DroidKnights 2026] Workflow AX 적용기 — 자동 정책 정리부터 E2E까지
dayeon
0
120
AIコーディング時代のKotest ユニットテストから APIレベルの仕様固定化テストへ
ooga04
0
310
Kotlin JVM用に作られたライブラリのKMPを前提とした再設計
jsoizo
0
220
Proxmox x Talos Linux x Terraform で実現するなんかいい感じの Kubernetes クラスタ / A Sleek Kubernetes Cluster Powered by Proxmox, Talos Linux, and Terraform
nnaka2992
0
280
DroidKnights 2026 Android A2UI Jetpack Compose 기반의 안전한 AI UI 렌더링 - 박제창
itsmedreamwalker
1
260
AI時代のシニアエンジニアとは
yosuke_furukawa
PRO
15
12k
TanStack Vue Query と Pinia Colada から学ぶ非同期状態の型設計
aoshi
0
700
疎結合とは何か?ソフトウェア設計における結合バランスについて考える #phpcon_niigata
kajitack
2
390
느린 네트워크와 저사양 디바이스 사용자를 위한 웹뷰 로딩 시간 개선기
kmkim
1
270
Materialが消えた日 〜真っ白なFlutterキャンバスにRenderObjectで絵を描く〜
umigishiaoi
0
170
AI時代のIaC入門 〜なぜインフラをコードで管理したいのか?〜 / Introduction to IaC in the AI Era
akihisaikeda
6
1.6k
Featured
See All Featured
Writing Fast Ruby
sferik
630
63k
Max Prin - Stacking Signals: How International SEO Comes Together (And Falls Apart)
techseoconnect
PRO
0
540
Claude Code どこまでも/ Claude Code Everywhere
nwiizo
68
61k
Tips & Tricks on How to Get Your First Job In Tech
honzajavorek
1
850
Future Trends and Review - Lecture 12 - Web Technologies (1019888BNR)
signer
PRO
0
3.8k
Technical Leadership for Architectural Decision Making
baasie
4
650
Crafting Experiences
bethany
1
450
技術選定の審美眼(2025年版) / Understanding the Spiral of Technologies 2025 edition
twada
PRO
121
130k
ラッコキーワード サービス紹介資料
rakko
5
6M
Documentation Writing (for coders)
carmenintech
77
5.6k
Collaborative Software Design: How to facilitate domain modelling decisions
baasie
1
390
Leveraging LLMs for student feedback in introductory data science courses - posit::conf(2025)
minecr
1
480