Frameworks and tools for testing
There are a lot of tools we can use for writing out unit tests, all of them with pros and cons and serving different purposes. But among all of them, there are two that will most likely cover almost every scenario, and therefore we limit this section to just them.
Along with testing frameworks and test running libraries, it's often common to find projects that configure code coverage, which they use as a quality metric. Since coverage (when used as a metric) is misleading, after seeing how to create unit tests we'll discuss why it's not to be taken lightly.
Frameworks and libraries for unit testing
In this section, we will discuss two frameworks for writing and running unit tests. The first one, unittest
, is available in the standard library of Python, while the second one, pytest
, has to be installed externally via pip
.
When it comes to covering testing scenarios...