What is and how do we measure code coverage

Written by: Gabriel Voicu

Test quality is very important and one of the most important things in building quality tests is to cover all production code lines with tests.

Code coverage is a metric that shows us the percentage of code that is covered by tests. Using test coverage we can also identify the lines of code that we missed.
Coverage 1 Using IntelliJ Idea to check for code coverage.
All modern IDEs have a tool that allows us to run tests with code coverage. This way we will be able to see what methods and lines of production code we didn’t cover and write more tests before pushing the code into a repository. Another great way to check code coverage is to use a tool like SonarQube.
Coverage 2 Covered lines are green and uncovered are red.