[Python-ideas] [Brainstorm] Testing with Documented ABCs
Antoine Pitrou
solipsis at pitrou.net
Wed Nov 28 09:18:10 EST 2018
On Tue, 27 Nov 2018 22:47:06 -0600
Abe Dillon <abedillon at gmail.com> wrote:
>
> If we could figure out a cleaner syntax for defining invariants,
> preconditions, and postconditions we'd be half-way to automated testing
> UTOPIA! (ok, maybe I'm being a little over-zealous)
I think utopia is the word here. Fuzz testing can be useful, but it's
not a replacement for manual testing of carefully selected values.
Also, the idea that fuzz testing will automatically find edge cases in
your code is idealistic. It depends on the algorithm you've
implemented and the distribution of values chosen by the tester.
Showcasing trivially wrong examples (such as an addition function that
always returns 0, or a tail function that doesn't return the tail)
isn't very helpful for a real-world analysis, IMHO.
In the end, you have to be rigorous when writing tests, and for most
non-trivial functions it requires that you devise the distribution of
input values depending on the implemented algorithm, not leave that
distribution to a third-party library that knows nothing about your
program.
Regards
Antoine.
More information about the Python-ideas
mailing list