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
420
BDD NL
paweldudek
0
270
BDD Bialystok/Wroclaw
paweldudek
0
190
Poznan TDD Workshop Part 1
paweldudek
0
88
Behaviour Driven Development - Mobile Trends
paweldudek
1
380
BDD Mobilization
paweldudek
0
130
Behaviour Driven Development - the whys and hows
paweldudek
0
190
Custom Collection View Layouts
paweldudek
0
94
Other Decks in Programming
See All in Programming
まだ間に合う!今年の夏こそSchemeのマクロ展開器を完全理解!
omasanori
0
400
生成AIで帳票OCRが「簡単に」作れる時代になった?
kon_shou
0
1.1k
Japan Community Day at Kubecon + CloudNativeCon Japan 2026: Learning Container Privilege Control by Building My Own Low-Level Container Runtime
ternbusty
1
170
Go 1.27 における memory allocation の高速化
andpad
0
300
人間の目はかわらない、だからJPEGは30年もつ
yuzneri
12
19k
My Marp Sample
sinoue0108
0
110
Go を使い始めて 2 ヶ月の学び / My first two months with Go
contour_gara
0
370
How I Won Prize Money at a Hackathon Using Codex and Symphony Alpha
yasei_no_otoko
0
120
為什麼你並不需要ViewModel / No, you don't need a ViewModel
lovee
1
510
tsc.rip を支える技術 / Kyoto.なんか #8
susisu
0
120
Claude CodeとAgentCore Gatewayを繋ぐ際の認証認可 / Authentication and authorization when connecting Claude Code with AgentCore Gateway
har1101
2
360
Loosening the Reins: Go Generics Get More Flexible
kuro_kurorrr
0
290
Featured
See All Featured
Lightning Talk: Beautiful Slides for Beginners
inesmontani
PRO
2
640
No one is an island. Learnings from fostering a developers community.
thoeni
21
3.8k
Jamie Indigo - Trashchat’s Guide to Black Boxes: Technical SEO Tactics for LLMs
techseoconnect
PRO
0
630
Build your cross-platform service in a week with App Engine
jlugia
234
19k
Mobile First: as difficult as doing things right
swwweet
225
10k
Lightning talk: Run Django tests with GitHub Actions
sabderemane
0
240
Ecommerce SEO: The Keys for Success Now & Beyond - #SERPConf2024
aleyda
1
2.1k
Visual Storytelling: How to be a Superhuman Communicator
reverentgeek
2
620
Designing for humans not robots
tammielis
254
26k
The Organizational Zoo: Understanding Human Behavior Agility Through Metaphoric Constructive Conversations (based on the works of Arthur Shelley, Ph.D)
kimpetersen
PRO
0
420
The Success of Rails: Ensuring Growth for the Next 100 Years
eileencodes
47
8.3k
Marketing Yourself as an Engineer | Alaka | Gurzu
gurzu
0
280
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!