Reader small image

You're reading from  Clean Code in PHP

Product typeBook
Published inOct 2022
PublisherPackt
ISBN-139781804613870
Edition1st Edition
Tools
Right arrow
Authors (2):
Carsten Windler
Carsten Windler
author image
Carsten Windler

Carsten Windler is a Lead PHP engineer at Plan A.
Read more about Carsten Windler

Alexandre Daubois
Alexandre Daubois
author image
Alexandre Daubois

Alexandre Daubois is a Symfony Developer at SensioLabs, the company that created Symfony.
Read more about Alexandre Daubois

View More author details
Right arrow

About code coverage

Now we’ve explored the different test types, you probably want to start writing tests right away. But before you put this book away to get coding, let us finish this chapter with the question of how much of your code you should test.

A part of the answer lies within the concept of code coverage, which we already briefly mentioned in Chapter 8, Code Quality Metrics when we talked about code quality metrics. Let us have a closer look at it now.

Understanding code coverage

Code coverage measures the proportion of code that is covered with tests. The higher the code coverage, the better—if there are more tests, the software is less likely to contain bugs, and it will be harder to introduce new ones unnoticed. Higher code coverage is also a possible indicator of better code quality—as we discussed in a previous section of this chapter, tested code must be written in a certain way, which usually leads to better quality.

Generally, the...

lock icon
The rest of the page is locked
Previous PageNext Page
You have been reading a chapter from
Clean Code in PHP
Published in: Oct 2022Publisher: PacktISBN-13: 9781804613870

Authors (2)

author image
Carsten Windler

Carsten Windler is a Lead PHP engineer at Plan A.
Read more about Carsten Windler

author image
Alexandre Daubois

Alexandre Daubois is a Symfony Developer at SensioLabs, the company that created Symfony.
Read more about Alexandre Daubois