> When I got started, I had just learned how to use yacc (really Bison) and lex (really flex) I've dug into parsers a few times, but everything I encountered seemed to think that once I had a parsed tree of commands it was obvious how to consume it...and it wasn't (for me). I've never had the free time to dedicate to experimenting that abstractly, so anytime I'm tempted to write a DSL or similar for a current problem…
The Day I Fell in Love with Fuzzing
21–30 of 49 posts
Re: The Day I Fell in Love with Fuzzing
#22If you're interested in trying out fuzzing without having to learn the intricacies of AFL or set things up manually, let me know[2] and I can get you set up with an account to play around with.
Happy to answer any questions about AFL/Fuzzbuzz!
[2] everest [at] fuzzbuzz [dot] io
Re: The Day I Fell in Love with Fuzzing
#23I haven't tried afl-fuzz myself, although it sounds like world-class awesome software, but I'm a real believer in testing things with David MacIver's Hypothesis, which invokes your functions with random inputs, and then does similar canonicalization and minimization kinds of things. I like Hypothesis so much that when I wrote Dumpulse http://github.com/kragen/dumpulse I added a Python interface to it purely so I coul…
Re: The Day I Fell in Love with Fuzzing
#24I haven't tried afl-fuzz myself, although it sounds like world-class awesome software, but I'm a real believer in testing things with David MacIver's Hypothesis, which invokes your functions with random inputs, and then does similar canonicalization and minimization kinds of things. I like Hypothesis so much that when I wrote Dumpulse http://github.com/kragen/dumpulse I added a Python interface to it purely so I coul…
I love the concept of hypothesis, but I struggle with finding a real life use case. I just can't formulate my assertions, I don't know what to put in them. unit tests are easy since I know what the code does, and I can just tell it what to do and what I expect. But with hypothesis, I have to find some kind of general property, which I have a hard time to do. Any tips, or materials I can use ? P.S: I read your test.py…
https://hypothesis.works/articles/rule-based-stateful-testin...
http://propertesting.com/book_stateful_properties.html
For a long time, I felt the same way you describe: all introductions to property-based testing show you things like testing a function that reverses a list and yes it all looks very useful and nifty, but it's hard to imagine how to formulate interesting variants for more complex code. These two posts were the first to really give me a fuller picture and lots of practical strategies:
https://fsharpforfunandprofit.com/posts/property-based-testi...
https://fsharpforfunandprofit.com/posts/property-based-testi...
(In general, everything I've ready/watched by Scott Wlaschin has been super helpful, and I've never written a line of F#.)
Re: The Day I Fell in Love with Fuzzing
#25Earlier quoted context omitted.
I love the concept of hypothesis, but I struggle with finding a real life use case. I just can't formulate my assertions, I don't know what to put in them. unit tests are easy since I know what the code does, and I can just tell it what to do and what I expect. But with hypothesis, I have to find some kind of general property, which I have a hard time to do. Any tips, or materials I can use ? P.S: I read your test.py…
You might find these useful: https://hypothesis.works/articles/rule-based-stateful-testin... http://propertesting.com/book_stateful_properties.html For a long time, I felt the same way you describe: all introductions to property-based testing show you things like testing a function that reverses a list and yes it all looks very useful and nifty, but it's hard to imagine how to formulate interesting variants for more…
Re: The Day I Fell in Love with Fuzzing
#26Earlier quoted context omitted.
You might find these useful: https://hypothesis.works/articles/rule-based-stateful-testin... http://propertesting.com/book_stateful_properties.html For a long time, I felt the same way you describe: all introductions to property-based testing show you things like testing a function that reverses a list and yes it all looks very useful and nifty, but it's hard to imagine how to formulate interesting variants for more…
Thanks a lot. This is why I still use HN :)
Re: The Day I Fell in Love with Fuzzing
#27Re: The Day I Fell in Love with Fuzzing
#28Fuzzing is super powerful, but can be a bit complicated to set up - that's why I'm working on a fuzzing-as-a-service platform[1] that automates a bunch of the steps described here. If you're interested in trying out fuzzing without having to learn the intricacies of AFL or set things up manually, let me know[2] and I can get you set up with an account to play around with. Happy to answer any questions about AFL/Fuzzb…
Re: The Day I Fell in Love with Fuzzing
#29I haven't tried afl-fuzz myself, although it sounds like world-class awesome software, but I'm a real believer in testing things with David MacIver's Hypothesis, which invokes your functions with random inputs, and then does similar canonicalization and minimization kinds of things. I like Hypothesis so much that when I wrote Dumpulse http://github.com/kragen/dumpulse I added a Python interface to it purely so I coul…
I love the concept of hypothesis, but I struggle with finding a real life use case. I just can't formulate my assertions, I don't know what to put in them. unit tests are easy since I know what the code does, and I can just tell it what to do and what I expect. But with hypothesis, I have to find some kind of general property, which I have a hard time to do. Any tips, or materials I can use ? P.S: I read your test.py…
The most basic things to check
- No valid inputs give an error
- All invalid inputs give a error
These are enhanced if you sprinkle your code with assertions. Writing assertions inside the code is good training to identify. Something supposed always non-negative, check it. Something always supposed to have more than 0 entries, check it. Something supposed to be sorted, check a[0] Often you can test symmetry type properties
- deserialize(serialize(in)) == in.
- init(); connect(); disconnect(); -> state identical as just init();
Or you can use an 'oracle', something external that tells you whether the output is correct or not.
- allTricksOptimized(in) == simpleReferenceImplementation(in)
- myImplementation(in) == thirdparty.implementation(in)
Re: The Day I Fell in Love with Fuzzing
#30Earlier quoted context omitted.
I love the concept of hypothesis, but I struggle with finding a real life use case. I just can't formulate my assertions, I don't know what to put in them. unit tests are easy since I know what the code does, and I can just tell it what to do and what I expect. But with hypothesis, I have to find some kind of general property, which I have a hard time to do. Any tips, or materials I can use ? P.S: I read your test.py…
How I often approach this is to 1) write a couple of unit tests 2) refactor unit tests into data-driven tests, using pytest.mark.parametrize 3) use hypothesis to generate the data. I very often get to 2, but not always to 3. The most basic things to check - No valid inputs give an error - All invalid inputs give a error These are enhanced if you sprinkle your code with assertions. Writing assertions inside the code i…