- Understand fuzz testing
- Use a fuzzing library in your test data builders
- Improve tests readability
3 facts about example based tests
- Do a presentation of fuzz testing
- Present a test fuzzing library and use it in a demo to to make an existing test data builder fuzzy
Proving correctness of code
- Feature compliance: Does it really test the feature I am trying to provide?
- Input scope covered: How well do I cover all possible inputs?
How to file the gap between randomness and example based tests?
Fuzzers to the rescue!
In example based tests, data used to build an object are rarely all involved in the scenario:
- involved data must be set invariant
- non involved data can be instantiated with random valid values, so they may be used to catch non-predicted behaviors
Fuzzer principles
- Generate random values, respecting some defined rules (eg: a random email, an address, a positive integer...)
- Use a seed if needed to reproduce an error
- use a fuzzing library to generate arbitrary data in the builders (c#)
- explain how to set a seed to make generated data deterministic (eg: to reproduce an error)
- launch tests many times to see if some test fail
- focus on the tests : which values can we keep fuzzed and which values must be defined ?
- make the learners apply what you demonstrated
- help them do the same for other builders
- should we make all builders fuzzing ?
Discuss in pair for 3 minutes on the question:
Where can you use fuzzing test data builders in your codebase?