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
74
0
Share
Embed
Copy iframe code
Copy JS code
Copy link
Start on current slide
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
180
Windows Automation - Howard Feldman
lvrug
0
120
Separating Your Application from Rails - Brian Hughes
lvrug
0
170
SWIG and Ruby - David Grayson
lvrug
0
110
Practical Object-Oriented Design in Ruby - Charles Jackson
lvrug
3
150
The Hamster Gem - Ryan Mulligan
lvrug
1
130
Varnish+Redis - Russ Smith
lvrug
1
150
Lambdas and Pops - Jan Hettich
lvrug
0
120
Making Good Use of Fonts - Russ Smith
lvrug
1
120
Featured
See All Featured
Stop Working from a Prison Cell
hatefulcrawdad
274
21k
Claude Code どこまでも/ Claude Code Everywhere
nwiizo
66
57k
Save Time (by Creating Custom Rails Generators)
garrettdimon
PRO
32
4.2k
So, you think you're a good person
axbom
PRO
2
2.1k
Designing Experiences People Love
moore
143
24k
VelocityConf: Rendering Performance Case Studies
addyosmani
333
25k
Agile Actions for Facilitating Distributed Teams - ADO2019
mkilby
0
240
Imperfection Machines: The Place of Print at Facebook
scottboms
270
14k
Raft: Consensus for Rubyists
vanstee
141
7.6k
How to Get Subject Matter Experts Bought In and Actively Contributing to SEO & PR Initiatives.
livdayseo
0
170
Prompt Engineering for Job Search
mfonobong
0
400
Docker and Python
trallard
47
4.1k
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