Skip to content

Commit ee963de

Browse files
committed
finish advanced testing
1 parent ecd7419 commit ee963de

File tree

2 files changed

+38
-5
lines changed

2 files changed

+38
-5
lines changed

ch02testsandsmells/05Advanced.ipynb.py

Lines changed: 37 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -321,8 +321,40 @@ def smart_square(a: float | int | bool | str) -> int | float:
321321
# [pre-commit.ci](https://pre-commit.ci).
322322

323323
# %% [markdown]
324-
# ## Hypothesis
325-
326-
327-
# %% [markdown]
328-
# ## Mutation
324+
# ## Property based testing
325+
# Property-based testing is a testing method that automatically generates
326+
# and tests a wide range of inputs, often missed by tests written by humans.
327+
#
328+
# [Hypthesis](https://hypothesis.readthedocs.io/en/latest/) is a modern
329+
# property based testing implementation for Python. The library creates unit
330+
# tests. In a nutshell, Hypothesis can parametrize test, running test function
331+
# over a wide range of matching data from a "search strategy" established by
332+
# the library. Through paratemerization, Hypothesis can catch bugs which might
333+
# go unnoticed by writing manual inputs for the tests.
334+
#
335+
# Property based testing is being adopted by software written in various
336+
# languages, especially by industries, to ensure the effectiveness of the
337+
# tests written for their software suite.
338+
#
339+
# ## Mutation testing
340+
#
341+
# Mutation testing checks the effectiveness of your tests by making minor
342+
# modification to the codebase and running the test suite. The tests were
343+
# not specific or good enough if they pass with the modifications made by
344+
# the mutation testing framework.
345+
#
346+
# [mutmut](https://mutmut.readthedocs.io/en/latest/) is a mutation testing
347+
# library for Python which is being adopted recently in testing frameworks
348+
# of large projects. There exists other libraries that perform a similar task
349+
# such as -
350+
# - [pytest-testmon](https://github.com/tarpas/pytest-testmon): pytest plug-in
351+
# which automatically selects and re-executes only tests affected by recent
352+
# changes
353+
# - [MutPy](https://github.com/mutpy/mutpy) (unmaintained): mutation testing
354+
# tool for Python 3.3+ source code
355+
# - [Cosmic Ray](https://cosmic-ray.readthedocs.io/en/latest/): mutation testing
356+
# for Python
357+
#
358+
# Overall, mutation testing is a very powerful way to check is your tests are
359+
# actually working, and this form of testing is beneficial for projects with
360+
# a large test suite.

index.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,7 @@ TODO
4545
<li>Rebasing and Merging</li>
4646
<li>Debugging with GitBisect</li>
4747
<li>Forks, Pull Requests and the GitHub Flow</li>
48+
<li>* Virtual Environments</li>
4849
</ul>
4950
</td>
5051
<td>

0 commit comments

Comments
 (0)