[erlang-questions] Do you know what your code is doing at night?
Loïc Hoguin
essen@REDACTED
Thu Jul 13 09:46:09 CEST 2017
On 07/13/2017 09:12 AM, Manfred Lotz wrote:
> However, I have a general question:
>
> Are unit testing and property based testing to be seen as both
> complementing each other, or is property based testing to be regarded
> to fully replace unit testing as it should (?) cover a proper superset
> of the tests in unit testing?
I'm not Fred, but I do have some insight on that.
Property based testing can largely replace the few random unit tests you
would write to test cases that you think about. It will also test cases
that you will not think about, and that's good.
Unit testing is still useful to make sure the textbook cases still work
though. If you have a spec (like an RFC) with some examples, you will
want to write unit tests for those, because properties are code and
might not be perfect.
And similarly, unit testing is still useful for testing against
regressions. Even if you fix your property, you should write a unit test
with the previously failing case to make sure you don't break your code
and your property again.
--
Loïc Hoguin
https://ninenines.eu
More information about the erlang-questions
mailing list