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
290
Testing value objects
franiglesias
0
270
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
CSC307 Lecture 13
javiergs
PRO
0
310
The Past, Present, and Future of Enterprise Java
ivargrimstad
0
300
「ブロックテーマでは再現できない」は本当か?
inc2734
0
1.1k
Metaprogramming isn't real, it can't hurt you
okuramasafumi
0
130
あなたはユーザーではない #PdENight
kajitack
4
290
2026/02/04 AIキャラクター人格の実装論 口 調の模倣から、コンテキスト制御による 『思想』と『行動』の創発へ
sr2mg4
0
640
DSPy入門 Pythonで実現する自動プロンプト最適化 〜人手によるプロンプト調整からの卒業〜
seaturt1e
1
370
AI巻き込み型コードレビューのススメ
nealle
2
2.4k
ご飯食べながらエージェントが開発できる。そう、Agentic Engineeringならね。
yokomachi
1
270
Amazon Bedrockを活用したRAGの品質管理パイプライン構築
tosuri13
5
900
Raku Raku Notion 20260128
hareyakayuruyaka
0
420
生成AIを使ったコードレビューで定性的に品質カバー
chiilog
1
310
Featured
See All Featured
Dealing with People You Can't Stand - Big Design 2015
cassininazir
367
27k
Odyssey Design
rkendrick25
PRO
2
530
Hiding What from Whom? A Critical Review of the History of Programming languages for Music
tomoyanonymous
2
470
Into the Great Unknown - MozCon
thekraken
40
2.3k
StorybookのUI Testing Handbookを読んだ
zakiyama
31
6.6k
SEO in 2025: How to Prepare for the Future of Search
ipullrank
3
3.3k
The agentic SEO stack - context over prompts
schlessera
0
670
The Cult of Friendly URLs
andyhume
79
6.8k
B2B Lead Gen: Tactics, Traps & Triumph
marketingsoph
0
64
Building Adaptive Systems
keathley
44
2.9k
Applied NLP in the Age of Generative AI
inesmontani
PRO
4
2.1k
The Success of Rails: Ensuring Growth for the Next 100 Years
eileencodes
47
8k
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