python - What is the difference between Property Based Testing and Mutation testing? -


my context question in python.

hypothesis testing library (i.e. property based testing): https://hypothesis.readthedocs.io/en/latest/

mutation testing library: https://github.com/sixty-north/cosmic-ray

these different beasts both improve value , quality of tests. both tools contribute , make "my code coverage n%" statement more meaningful.


hypothesis generate sorts of test inputs in defined scope function under test.

usually, when need test function, provide multiple example values trying cover use cases , edge cases driven code coverage reports - called "example based testing". hypothesis on other hand implements property-based testing generating whole bunch of different inputs , input combinations helping catch different common errors division zero, none, 0, off-by-one errors etc , helping find hidden bugs.

mutation testing changing code under test on fly while executing tests against modified version of code.

this helps see if tests testing supposed testing, understand value of tests. mutation testing shine if have rich test code base , code coverage.


what helped me ahold of these concepts these python podcasts:


Comments