Respect / Validation

The most awesome validation engine ever created for PHP
https://respect-validation.readthedocs.io
MIT License
5.79k stars 776 forks source link

Code coverage in local environment #1413

Closed dcorrea777 closed 1 year ago

dcorrea777 commented 1 year ago

I'm wanting to increase code coverage, but I'm having some problems related to the percentage generated by the codedcov tool and my local environment using phpunit + xdebug.

In my local environment using xdebug the total percentage is at 76.16%, but the codecov tool is with 94.57%. There is a very large file difference without test coverage in local environment.

As I want to increase code coverage by guiding myself through the report, it's a little difficult to create the new tests, I don't know if I'm doing something wrong in my environment.

I currently have the following php configuration.

PHP 8.1.12 (cli) (built: Nov 20 2022 23:34:07) (NTS)
Copyright (c) The PHP Group
Zend Engine v4.1.12, Copyright (c) Zend Technologies
    with Xdebug v3.2.0, Copyright (c) 2002-2022, by Derick Rethans

And using the following command to generate the coverage report.

vendor/bin/phpunit --testsuite=unit --coverage-html=report
alganet commented 1 year ago

You're not doing it wrong! Coverage for unit tests is about 76% only, I get the same results on my setup. The 95% report is for unit+integration.

I personally care more about increasing the unit coverage (making the 76% go higher), so maybe one day we can use only that suite for the coverage report.

If you want to increase the total coverage, that's cool as well! If you can find the tests that can increase both numbers, that would be great :D

dcorrea777 commented 1 year ago

Thank you very much @alganet !

I ran the integration tests and it worked, now I have the correct percentage value, now I can better guide myself in which tests I need to create.