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
Explore
Featured decks
Featured speakers
Programming
Technology
Storyboards
Pricing
Search
Sign in
Sign up for free
TDD Workshop - UIKonf 2016
Search
Sponsored
·
Your Podcast. Everywhere. Effortlessly.
Share. Educate. Inspire. Entertain. You do you. We'll handle the rest.
→
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
88
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
ソフトウェアラスタライザ
fadis
1
800
RSSとCodexを使ってX投稿自動化してみた
ochtum
0
110
AIに既存システムを理解させる技術 ~レガシーを見捨てないハーネスエンジニアリング入門~
ochtum
0
210
Go を使い始めて 2 ヶ月の学び / My first two months with Go
contour_gara
0
420
Foundry Localでエージェント開発
seosoft
0
150
Snowflakeで業務アプリを作ろう。 Snowflakeのアプリ機能解説&実践ガイド
ayumu_yamaguchi
1
160
iOS開発×AI駆動開発 〜最近使って便利だったスキルの話〜
nogu66
0
140
不幸な GC
chencmd
0
890
go-spidermonkeyでAIエージェントのCode Modeを実装する
syumai
3
1.5k
Webプラットフォームで議論されているセキュリティ課題 / Security issues being discussed on Web Platforms
petamoriken
0
260
アクセシビリティから考える情報設計
high_g_engineer
0
320
AI に Inclusive UI を書かせよう — Design Rules Skill で Compose UI を作り直す
theoriatec2024
1
460
Featured
See All Featured
Test your architecture with Archunit
thirion
2
2.4k
How STYLIGHT went responsive
nonsquared
100
6.3k
My Coaching Mixtape
mlcsv
0
310
A Tale of Four Properties
chriscoyier
163
24k
Cheating the UX When There Is Nothing More to Optimize - PixelPioneers
stephaniewalter
287
14k
Code Reviewing Like a Champion
maltzj
528
40k
Claude Code どこまでも/ Claude Code Everywhere
nwiizo
67
58k
No one is an island. Learnings from fostering a developers community.
thoeni
21
3.8k
The Impact of AI in SEO - AI Overviews June 2024 Edition
aleyda
6
1.2k
Beyond borders and beyond the search box: How to win the global "messy middle" with AI-driven SEO
davidcarrasco
3
240
Designing Experiences People Love
moore
143
24k
Fireside Chat
paigeccino
42
4k
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!