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
Sponsored
·
Your Podcast. Everywhere. Effortlessly.
Share. Educate. Inspire. Entertain. You do you. We'll handle the rest.
→
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
16th Malabo Montpellier Forum Presentation
akademiya2063
PRO
0
50
[Rails World 2023 - Day 1 Closing Keynote] - The Magic of Rails
eileencodes
38
2.7k
Principles of Awesome APIs and How to Build Them.
keavy
128
17k
Building an army of robots
kneath
306
46k
SEO for Brand Visibility & Recognition
aleyda
0
4.2k
CoffeeScript is Beautiful & I Never Want to Write Plain JavaScript Again
sstephenson
162
16k
Design and Strategy: How to Deal with People Who Don’t "Get" Design
morganepeng
133
19k
JavaScript: Past, Present, and Future - NDC Porto 2020
reverentgeek
52
5.8k
AI in Enterprises - Java and Open Source to the Rescue
ivargrimstad
0
1.1k
GitHub's CSS Performance
jonrohan
1032
470k
A brief & incomplete history of UX Design for the World Wide Web: 1989–2019
jct
1
300
[SF Ruby Conf 2025] Rails X
palkan
1
750
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