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
68
0
Share
Randomness in Testing - Paul Grayson
Las Vegas Ruby Group
September 25, 2013
More Decks by Las Vegas Ruby Group
See All by Las Vegas Ruby Group
Ruby ISO Standard - David Grayson
lvrug
0
170
Windows Automation - Howard Feldman
lvrug
0
110
Separating Your Application from Rails - Brian Hughes
lvrug
0
160
SWIG and Ruby - David Grayson
lvrug
0
100
Practical Object-Oriented Design in Ruby - Charles Jackson
lvrug
3
150
The Hamster Gem - Ryan Mulligan
lvrug
1
120
Varnish+Redis - Russ Smith
lvrug
1
140
Lambdas and Pops - Jan Hettich
lvrug
0
110
Making Good Use of Fonts - Russ Smith
lvrug
1
110
Featured
See All Featured
Exploring the relationship between traditional SERPs and Gen AI search
raygrieselhuber
PRO
2
4k
The Cost Of JavaScript in 2023
addyosmani
55
10k
Understanding Cognitive Biases in Performance Measurement
bluesmoon
32
2.9k
Claude Code のすすめ
schroneko
67
220k
Writing Fast Ruby
sferik
630
63k
Mozcon NYC 2025: Stop Losing SEO Traffic
samtorres
1
250
エンジニアに許された特別な時間の終わり
watany
107
250k
Breaking role norms: Why Content Design is so much more than writing copy - Taylor Woolridge
uxyall
0
310
We Are The Robots
honzajavorek
0
240
The AI Search Optimization Roadmap by Aleyda Solis
aleyda
1
5.9k
Digital Projects Gone Horribly Wrong (And the UX Pros Who Still Save the Day) - Dean Schuster
uxyall
0
1.6k
Code Review Best Practice
trishagee
74
20k
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