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
Randomness in Testing - Paul Grayson
Search
Las Vegas Ruby Group
September 25, 2013
0
49
Randomness in Testing - Paul Grayson
Las Vegas Ruby Group
September 25, 2013
Tweet
Share
More Decks by Las Vegas Ruby Group
See All by Las Vegas Ruby Group
Ruby ISO Standard - David Grayson
lvrug
0
110
Windows Automation - Howard Feldman
lvrug
0
56
Separating Your Application from Rails - Brian Hughes
lvrug
0
100
SWIG and Ruby - David Grayson
lvrug
0
62
Practical Object-Oriented Design in Ruby - Charles Jackson
lvrug
3
120
The Hamster Gem - Ryan Mulligan
lvrug
1
82
Varnish+Redis - Russ Smith
lvrug
1
90
Lambdas and Pops - Jan Hettich
lvrug
0
61
Making Good Use of Fonts - Russ Smith
lvrug
1
73
Featured
See All Featured
Into the Great Unknown - MozCon
thekraken
38
1.8k
Building Better People: How to give real-time feedback that sticks.
wjessup
368
19k
Why You Should Never Use an ORM
jnunemaker
PRO
56
9.4k
Easily Structure & Communicate Ideas using Wireframe
afnizarnur
194
16k
Learning to Love Humans: Emotional Interface Design
aarron
273
40k
GraphQLの誤解/rethinking-graphql
sonatard
71
10k
Building an army of robots
kneath
305
45k
How to Ace a Technical Interview
jacobian
276
23k
Building Applications with DynamoDB
mza
94
6.4k
YesSQL, Process and Tooling at Scale
rocio
172
14k
The Psychology of Web Performance [Beyond Tellerrand 2023]
tammyeverts
47
2.7k
The Straight Up "How To Draw Better" Workshop
denniskardys
233
140k
Transcript
Randomness in Testing Paul Grayson 2013-09-25
Normal testing: try edge cases • Easy when you have
a geometric picture:
“Fuzz testing” for difficult edges • What are the “edge
cases” here?
Fuzz testing kata example
Note: fuzz tests generally more simple-minded Things to Fuzz test
for: • exceptions or other bad behavior • outputs consistent with inputs • exact answer for a simplified domain (hard!)
Fuzz Testing: NOT part of RSpec • Just use rand
in your tests.
Test order dependence • Ideal: tests are independent • DO
NOT use objects created out of the context • DO NOT break when other objects exist
Test order kata example
When a test fails... • Write a test that always
fails, or fix the tests • Re-use the seed to debug rspec --seed 1234
Using RSpec seed with rand srand RSpec.configuration.seed + 1
Putting it together • Automatically re-use the seed
Other random examples • Code mutation • Unavoidable randomness (network,
threads) • Testing random code