Checking test coverage
Unit tests are most effective when there are tests to cover every class, method, function, or module in your program. As your software code grows, it is easy to forget to write tests or maybe to put them off until you have more time. PyCharm has a tool that can tell you what your test coverage is and helps you find unexploited opportunities for testing more of your work than you might have on your own.
To check your test coverage, you just need to run your tests a little bit differently. We’ve been running our tests individually from within the test files. We need to run all the tests together so that we can have a comprehensive report of where we are missing coverage. For this, we will make a new run configuration. Click the run configurations dropdown on the toolbar and click Edit Configurations. Add a new configuration using the Python unittest
template. Make sure you use my settings, as shown in Figure 6.22:
Figure 6.22...