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
testing the unpredictable
Search
Fran Iglesias
November 02, 2018
Programming
270
0
Share
Embed
Copy iframe code
Copy JS code
Copy link
Start on current slide
testing the unpredictable
Non deterministic tests
Fran Iglesias
November 02, 2018
More Decks by Fran Iglesias
See All by Fran Iglesias
Tips for daily refactoring
franiglesias
0
380
Introduction to TDD: Red-Green-Refactor
franiglesias
1
340
Testing value objects
franiglesias
0
300
Tests doubles: the motion picture
franiglesias
0
570
Low cost techniques for test doubles
franiglesias
0
260
Other Decks in Programming
See All in Programming
AI が書く Go コードの品質を劇的に向上させる Linter: “declscope”
mpyw
0
450
Embedded Swiftで作る自作USBデバイス によるiOSデバイスの自動テスト / iOSDC Japan 2026 glassfiber
glassfiber
0
160
GitHubハンズオン講座 — 実務レベルのチーム開発のフローを身につけよう
junhat6
0
110
setup-vp GitLab対応の裏側
naokihaba
0
140
SREの越境 / SRE Collaboration
y0hgi
2
290
技術的負債を組織課題として解く-増えすぎたマイクロサービスとの戦い-
reimaru
1
2.5k
MVNOの申込からeSIM開通までをiOSアプリでつなぐ- 本人確認・MNP・通信事業者基盤をまたぐ実装
satotakeshi
0
510
速習iPhone Duo対応
yuukiw00w
2
910
設計次第でAIコードの読む量は減らせる / designing-for-code-reading
minodriven
30
13k
wkhtmltopdfの次どうするか問題2026
willnet
2
1.8k
ソニーのクラウド共通基盤の変遷とAI時代の開発スタイルに合わせた進化 / The Journey of Sony’s Common Cloud Platform and Its Evolution for AI-Native Development
kenjiyoneyama
0
200
Turning Architecture into Unit Tests in the AI Era (NSSpain XIV)
steliosf
PRO
1
120
Featured
See All Featured
Public Speaking Without Barfing On Your Shoes - THAT 2023
reverentgeek
1
580
4 Signs Your Business is Dying
shpigford
187
23k
A brief & incomplete history of UX Design for the World Wide Web: 1989–2019
jct
2
510
The State of eCommerce SEO: How to Win in Today's Products SERPs - #SEOweek
aleyda
2
12k
Imperfection Machines: The Place of Print at Facebook
scottboms
270
14k
Measuring Dark Social's Impact On Conversion and Attribution
stephenakadiri
2
290
Avoiding the “Bad Training, Faster” Trap in the Age of AI
tmiket
0
250
Darren the Foodie - Storyboard
khoart
PRO
4
4k
Lightning talk: Run Django tests with GitHub Actions
sabderemane
0
270
How to optimise 3,500 product descriptions for ecommerce in one day using ChatGPT
katarinadahlin
PRO
3
3.8k
Building Adaptive Systems
keathley
44
3.2k
Sam Torres - BigQuery for SEOs
techseoconnect
PRO
0
550
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