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
testing the unpredictable
Search
Sponsored
·
Your Podcast. Everywhere. Effortlessly.
Share. Educate. Inspire. Entertain. You do you. We'll handle the rest.
→
Fran Iglesias
November 02, 2018
Programming
0
230
testing the unpredictable
Non deterministic tests
Fran Iglesias
November 02, 2018
Tweet
Share
More Decks by Fran Iglesias
See All by Fran Iglesias
Tips for daily refactoring
franiglesias
0
340
Introduction to TDD: Red-Green-Refactor
franiglesias
1
280
Testing value objects
franiglesias
0
260
Tests doubles: the motion picture
franiglesias
0
510
Low cost techniques for test doubles
franiglesias
0
210
Other Decks in Programming
See All in Programming
今から始めるClaude Code超入門
448jp
8
8.6k
Oxlint JS plugins
kazupon
1
850
Smart Handoff/Pickup ガイド - Claude Code セッション管理
yukiigarashi
0
130
なぜSQLはAIぽく見えるのか/why does SQL look AI like
florets1
0
450
Data-Centric Kaggle
isax1015
2
770
カスタマーサクセス業務を変革したヘルススコアの実現と学び
_hummer0724
0
680
AIによる開発の民主化を支える コンテキスト管理のこれまでとこれから
mulyu
3
170
AIエージェント、”どう作るか”で差は出るか? / AI Agents: Does the "How" Make a Difference?
rkaga
4
2k
生成AIを使ったコードレビューで定性的に品質カバー
chiilog
1
260
AIと一緒にレガシーに向き合ってみた
nyafunta9858
0
190
Oxlintはいいぞ
yug1224
5
1.3k
フロントエンド開発の勘所 -複数事業を経験して見えた判断軸の違い-
heimusu
7
2.8k
Featured
See All Featured
AI Search: Where Are We & What Can We Do About It?
aleyda
0
6.9k
Marketing Yourself as an Engineer | Alaka | Gurzu
gurzu
0
130
Distributed Sagas: A Protocol for Coordinating Microservices
caitiem20
333
22k
Making Projects Easy
brettharned
120
6.6k
Measuring & Analyzing Core Web Vitals
bluesmoon
9
750
Agile Actions for Facilitating Distributed Teams - ADO2019
mkilby
0
110
Everyday Curiosity
cassininazir
0
130
SEO in 2025: How to Prepare for the Future of Search
ipullrank
3
3.3k
We Have a Design System, Now What?
morganepeng
54
8k
Design in an AI World
tapps
0
140
Leveraging LLMs for student feedback in introductory data science courses - posit::conf(2025)
minecr
0
140
WCS-LA-2024
lcolladotor
0
450
Transcript
TDD 101 4. Testing the unpredictable
Testing the unpredictable
Testing the unpredictable Elements beyond our system: • Randomness •
Time • File system You can’t rely on their behavior
How can we test?
1. Things that are using unpredictable components They are global
state dependencies Isolate and extract Invert dependency Stub for testing
Example class User { private $id; private $name; public function
__construct(string $name) { $this->id = Uuid::uuid4(); $this->name = $name; } }
Example class User { private $id; private $name; public function
__construct( UserId $id, string $name ) { $this->id = $id; $this->name = $name; } }
2. Things that are unpredictable Don’t test what you don’t
own Test for properties of the output, not the output itself
Example class PasswordGeneratorTest extends TestCase { public function testShouldBeLongEnough() {
$password = $this->generator->generate(); $this->assertTrue(strlen($password) > 9); } }
Avoid coupling with dependency inversion
Dependency Inversion High level modules should not depend on low
level modules, both should depend on abstractions. Abstractions should not depend on details. Details should depend on abstractions.
Thigh coupling MyClass Dependency Uses
Dependency inversion MyClass Interface Dependency Uses Implements
Dependency inversion & adapter pattern MyClass Interface Dependency Uses Implements
Adapter Uses
None