Code coverage

We won't discuss it in depth, but code coverage is another important measure used in software engineering. Code coverage measures the degree of code that your test suites cover. The main idea is that the higher the coverage percentage, the more code is covered by tests, so the less likely you are to create undetected bugs and the service should behave as intended. These reports can help developers come up with additional tests or scenarios to increase the coverage percentage.

Test-coverage-related Python packages include coverage, nose, and the more recent nose2, which can provide coverage reports. For example, you can run the following to get a test-coverage analysis report of your Lambda code with nose or nose2:

$ nosetests test/test_dynamo_get.py --with-coverage --cover-package lambda_dynamo_read -v
$ nose2 --with-coverage

When we commence with writing our own tests, we have an option to use an additional set of tools to do so. Such tools are known as code coverage tools. Codecov and Coveralls are examples of such tools. When we want to analyze the code that is written via hosting services such as GitHub, these tools are very helpful as they provided a complete breakdown of whether the lines are tested.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset