Why Property Testing Finds Bugs Unit Testing Does Not (2021)
1–10 of 90 posts
Re: Why Property Testing Finds Bugs Unit Testing Does Not (2021)
#2Re: Why Property Testing Finds Bugs Unit Testing Does Not (2021)
#3Re: Why Property Testing Finds Bugs Unit Testing Does Not (2021)
#4Seems like a unit test tests specific input and property testing tests more than one input.
Re: Why Property Testing Finds Bugs Unit Testing Does Not (2021)
#5Re: Why Property Testing Finds Bugs Unit Testing Does Not (2021)
#6I independently discovered PBT when I was a junior, and suggested we use it. My coworkers rejected it because tests should be predictable, and it's the programmer's job to pick the edge cases.
Re: Why Property Testing Finds Bugs Unit Testing Does Not (2021)
#7Aw man, I was nodding along with the "most examples suck" section and then... it ended :(
The complexity here is the complete opposite of the simple toy examples. What are the edge cases of an optimizing compiler? How do you even approach them, if they're buried deep in a chain of transformations?
The properties are simple things like "the compiler shouldn't crash, the compiled code shouldn't crash, and code compiled with different optimization levels should do the same thing." This assumes the randomly generated code doesn't touch undefined behavior in the language spec.
Here's a recent example of a bug found by this approach. The Common Lisp code stimulating the bug has been automatically minimized: https://bugs.launchpad.net/sbcl/+bug/2109837 with the bug fix https://sourceforge.net/p/sbcl/sbcl/ci/1abebf7addda1a43d6d24...
Re: Why Property Testing Finds Bugs Unit Testing Does Not (2021)
#8Isn't unit testing a subset of property testing? Seems like a unit test tests specific input and property testing tests more than one input.
Also, if you never look at the test data, it might give you false confidence about how thoroughly your code is being tested.