Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Speaker Deck
PRO
Sign in
Sign up for free
Property-based testing: The lazy programmer's guide to writing thousands of tests
Pierre GOUDJO
January 20, 2022
Programming
0
36
Property-based testing: The lazy programmer's guide to writing thousands of tests
Pierre GOUDJO
January 20, 2022
Tweet
Share
More Decks by Pierre GOUDJO
See All by Pierre GOUDJO
Simplicity matters
pierregoudjo
0
3
Always available workspaces: Dotfiles, Github and other shenanigans
pierregoudjo
0
17
Amazon Virtual Private Cloud
pierregoudjo
0
27
Service Discovery: Fundamentals
pierregoudjo
0
21
Relational Databases on AWS: Amazon RDS and Aurora
pierregoudjo
0
22
Object storage: An exploration of AWS S3
pierregoudjo
0
15
Load Balancing: A strategy for scalable internet applications
pierregoudjo
0
23
Boring Technologies
pierregoudjo
0
19
CDN: Caching and edge computing on AWS
pierregoudjo
0
19
Other Decks in Programming
See All in Programming
ES2022の新機能
smt7174
0
270
React Nativeアプリを DDDで開発している話
nihemak
0
150
Reactは何を提供するLibraryなのか?
taro28
3
500
クックパッドマートの失敗したデータ設計 Before / After 大放出
mokuzon
0
180
Angular-basierte Micro Frontends mit Module Federation @API Summit
manfredsteyer
PRO
0
110
Reactive Java Microservices on Kubernetes with Spring and JHipster
deepu105
1
170
CSE360 Tutorial 07
javiergs
PRO
0
100
社用PCのdotfiles管理 / dotfiles-in-company
yammerjp
0
140
Android Compose Component - mapping.
taehwandev
0
140
Java アプリとAWS の良い関係 - AWS でJava アプリを実行する一番簡単な方法教えます / AWS for Javarista
kanamasa
2
1.3k
Let's keep Commodore 64 alive for the next 40 years
mehowte
1
110
競プロのすすめ
uya116
0
680
Featured
See All Featured
The Brand Is Dead. Long Live the Brand.
mthomps
46
2.7k
KATA
mclloyd
7
8.7k
From Idea to $5000 a Month in 5 Months
shpigford
373
44k
Gamification - CAS2011
davidbonilla
75
3.9k
Refactoring Trust on Your Teams (GOTO; Chicago 2020)
rmw
19
1.4k
How to name files
jennybc
40
61k
Building a Scalable Design System with Sketch
lauravandoore
448
30k
Design and Strategy: How to Deal with People Who Don’t "Get" Design
morganepeng
105
16k
The Invisible Side of Design
smashingmag
290
48k
Fight the Zombie Pattern Library - RWD Summit 2016
marcelosomers
226
15k
Stop Working from a Prison Cell
hatefulcrawdad
261
17k
Cheating the UX When There Is Nothing More to Optimize - PixelPioneers
stephaniewalter
269
11k
Transcript
Pierre Goudjo Property-based testing The lazy programmer's guide to writing
thousands of tests
“Real-life” Scenario
None
None
None
None
None
None
None
None
None
None
None
None
None
None
None
None
None
None
None
None
None
None
None
Solution
What’s an addition?
None
None
Properties Addition • Associativity: x+(y+z) = (x+y)+z • Commutativity: x
+ y = y + x • Identity Element: x+0 = x
This is property-based testing
for any (x, y, …) such as precondition(x, y, …)
holds property(x, y, …) is true
Let’s implement this!!!!
Is it useful?
Avg • for any number (a and b ) •
such a <= b • a <= avg(a, b) and avg(a, b) <= b • for any number (a and b ) • such a <= b • avg(a, b) == avg(a, b)
Zip/Unzip • for any string (x) • such as x
not “” • unzip(zip(x)) == x is true