[erlang-questions] Do you know what your code is doing at night?

Manfred Lotz <>
Thu Jul 13 13:12:12 CEST 2017


Hi Loic,
Thanks for your reply.

On Thu, 13 Jul 2017 09:46:09 +0200
Loïc Hoguin <> wrote:

> 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.
> 

Your reply is absolutely excellent, and makes much sense to me. 

I think Fred could add a section "Unit testing versus property based
testing" and add your explanations.


Many thanks, Manfred





More information about the erlang-questions mailing list