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
54
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
130
Windows Automation - Howard Feldman
lvrug
0
68
Separating Your Application from Rails - Brian Hughes
lvrug
0
120
SWIG and Ruby - David Grayson
lvrug
0
75
Practical Object-Oriented Design in Ruby - Charles Jackson
lvrug
3
130
The Hamster Gem - Ryan Mulligan
lvrug
1
90
Varnish+Redis - Russ Smith
lvrug
1
100
Lambdas and Pops - Jan Hettich
lvrug
0
79
Making Good Use of Fonts - Russ Smith
lvrug
1
88
Featured
See All Featured
Reflections from 52 weeks, 52 projects
jeffersonlam
352
21k
4 Signs Your Business is Dying
shpigford
185
22k
Why Our Code Smells
bkeepers
PRO
339
57k
Art, The Web, and Tiny UX
lynnandtonic
303
21k
Refactoring Trust on Your Teams (GOTO; Chicago 2020)
rmw
35
3.2k
Bootstrapping a Software Product
garrettdimon
PRO
307
110k
Easily Structure & Communicate Ideas using Wireframe
afnizarnur
194
16k
Embracing the Ebb and Flow
colly
88
4.8k
KATA
mclloyd
32
15k
Java REST API Framework Comparison - PWX 2021
mraible
33
8.9k
Making Projects Easy
brettharned
119
6.4k
"I'm Feeling Lucky" - Building Great Search Experiences for Today's Users (#IAC19)
danielanewman
229
22k
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