What is this about?
It’s about a built-in feature of Codeception (a tool powering the Falcon’s testing suite, which is a BehaviourDrivenDevelopment-styled PHP testing framework, brought to you by Codeception Team, OpenSource and MITLicensed), which helps in analyzing the code coverage.
This feature of Codeception allows you to collect code coverage reports for all your tests: unit, functional, and acceptance and merge them together. So now you can review what parts of your applications are tested and which are not.
Oh nice, but sorry I don’t have the bucks
Well, this is absolutely FREE!
Great, but sorry I don’t have that much time to install and set up the configs
Installation and setup can be done in the time you finish reading this message.
Step 1. Install Codeception
installed via PEAR
$ pear install codeception/Codeception
or via Composer
$ php composer.phar update
Step 2. Configure code coverage
To enable code coverage put these lines in the global configuration file codeception.yml:
coverage: enabled: true include: - app/*
Step 3. Generate the report
To generate a clover xml report or a tasty html report append also –coverage-xml and –coverage-html options.
codecept run unit --coverage --coverage-xml --coverage-html
Cool, tell me what do you have?
When you execute your tests to collect coverage report, you will receive statistics of all classes, methods, and lines triggered by these tests. The ratio between all lines in the script and all touched lines is the main coverage criterion.
In the ideal world, you should get 100% code coverage. But in reality, this is relative to an individual project (Falcon has set a different percentage threshold for different classes). Because, where on one hand even 100% code coverage rate doesn’t save you from fatal errors and crashes, on the other hand, a code coverage for classes which are crucial from a logical point of view, a coverage tending to 100% is pivotal.
As shown below, this feature provides a comprehensive analysis of Line Coverage, Method Coverage, and Class level coverage of your project. Along with this, it also provides visuals in form of graphs in the dashboards shown below.
This is how the dashboards and visual stats look like –

Oh CRAP!
As shown in the image below, not only do you have a comprehensive and exhaustive analysis of the coverage from this tool, but you also get CRAP score for your functions of the respective classes.
As we reach the end, I hope that setup of yours is done. So what are you waiting for? Get your project onboard with this so that you can “Refactor with Confidence”! ✌️
References
Installation: https://codeception.com/install, https://codeception.com/docs/11-Codecoverage