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
57
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
150
Windows Automation - Howard Feldman
lvrug
0
91
Separating Your Application from Rails - Brian Hughes
lvrug
0
140
SWIG and Ruby - David Grayson
lvrug
0
89
Practical Object-Oriented Design in Ruby - Charles Jackson
lvrug
3
140
The Hamster Gem - Ryan Mulligan
lvrug
1
100
Varnish+Redis - Russ Smith
lvrug
1
120
Lambdas and Pops - Jan Hettich
lvrug
0
92
Making Good Use of Fonts - Russ Smith
lvrug
1
98
Featured
See All Featured
Between Models and Reality
mayunak
1
190
Designing for humans not robots
tammielis
254
26k
Why You Should Never Use an ORM
jnunemaker
PRO
61
9.7k
VelocityConf: Rendering Performance Case Studies
addyosmani
333
24k
Conquering PDFs: document understanding beyond plain text
inesmontani
PRO
4
2.3k
WENDY [Excerpt]
tessaabrams
9
36k
<Decoding/> the Language of Devs - We Love SEO 2024
nikkihalliwell
1
130
The Hidden Cost of Media on the Web [PixelPalooza 2025]
tammyeverts
2
190
Agile Actions for Facilitating Distributed Teams - ADO2019
mkilby
0
110
First, design no harm
axbom
PRO
2
1.1k
sira's awesome portfolio website redesign presentation
elsirapls
0
150
16th Malabo Montpellier Forum Presentation
akademiya2063
PRO
0
50
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