Task #13493

Choose and add code coverage driver to development environments

Added by José Raddaoui Marín about 1 month ago. Updated 10 days ago.

Status:VerifiedStart date:03/27/2021
Priority:MediumDue date:
Assignee:José Raddaoui Marín% Done:

0%

Category:Tests
Target version:Release 2.7.0
Google Code Legacy ID: Tested version:
Sponsored:No Requires documentation:

Description

To be able to generate coverage reports from AtoM tests, one of the following extensions is needed:

- Xdebug
- PCOV
- phpdbg

After some readings, phpdbg seems to be inaccurate and Xdebug a lot less performant than PCOV ...

https://github.com/krakjoe/pcov#differences-in-reporting
https://medium.com/@nicocabot/speed-up-phpunit-code-coverage-analysis-4e35345b3dad
https://wrwdev.medium.com/speed-up-the-phpunit-coverage-generation-af2b5c4fb1f6
https://itnext.io/phpunit-code-coverage-pcov-c21e715f8bf3

History

#1 Updated by José Raddaoui Marín about 1 month ago

For example, in Docker ...

docker-compose exec atom composer test -- --coverage-text

Warning:       No code coverage driver available

Additionally, after dropping support for PHP 7.2, we could upgrade PHPUnit to the latest version.

#2 Updated by José Raddaoui Marín about 1 month ago

  • Subject changed from Choose and add code coverage driver to development environments to Choose and add code coverage driver to development environments (and CI)
  • Status changed from In progress to Code Review
  • Assignee changed from José Raddaoui Marín to David Juhasz

#3 Updated by José Raddaoui Marín about 1 month ago

  • Status changed from Code Review to In progress
  • Assignee changed from David Juhasz to José Raddaoui Marín

Merged in qa/2.x.

The Docker environment now allows to generate coverage reports using PHPUnit and PCOV:

export COMPOSE_FILE="$PWD/docker/docker-compose.dev.yml" 
export ATOM_COVERAGE=true

docker-compose up -d
docker-compose exec atom php symfony tools:purge --demo
docker-compose exec atom composer test -- --coverage-html=.coverage/html

This is pretty much ready for the CI too but the coverage is currently so low (< 1%) that we'll wait to include coverage reports until the e2e tests are ready (#13473).

I'll leave this ticket in progress to also check the Vagrant box development environment.

#4 Updated by José Raddaoui Marín 15 days ago

PCOV PHP extension added to the AtoM Ansible role and installed in the latest Vagrant box (2.7.0.2) and other dev environments:

https://github.com/artefactual-labs/ansible-atom/pull/92

#5 Updated by José Raddaoui Marín 10 days ago

  • Subject changed from Choose and add code coverage driver to development environments (and CI) to Choose and add code coverage driver to development environments

#6 Updated by José Raddaoui Marín 10 days ago

  • Status changed from In progress to Verified

Also available in: Atom PDF