Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add code coverage support using pcov #1132

Open
JesKingDev opened this issue Apr 19, 2024 · 3 comments
Open

Add code coverage support using pcov #1132

JesKingDev opened this issue Apr 19, 2024 · 3 comments
Labels
pending more info stale Issue has not had recent activity or appears to be solved. Stale issues will be automatically closed

Comments

@JesKingDev
Copy link

Description
Generating code coverage with PHPUnit using xdebug.mode=coverage can be incredibly slow and uses a ton of memory (ex. over 8GB in our CI/CD pipelines). pcov is a more lightweight code coverage solution and is prioritized over xdebug by PHPUnit since version 7.0.9

While xdebug and pcov are not compatible, it's straightforward to pass the arguments to enable/disable when needed. Testing in my local environment showed a 75% decrease in both time and memory usage for integration tests.

Steps To Reproduce

  1. Enable xdebug with xdebug.mode=coverage
  2. Run make dev-test-run integration

Expected Result
Code coverage reports can be generated without significantly impacting speed or memory usage.

Actual Result
Running PHPUnit with code coverage results in high memory usage and slow performance - nearly 4 times slower/heavier for integration tests.

@YevhenZvieriev
Copy link
Contributor

Hi @JesKingDev

I completely agree that generating code coverage with PHPUnit using xdebug.mode=coverage can be extremely slow and resource-intensive, especially in CI/CD pipelines.

Can you give me more details about how it is implemented in your local development?

We can modify the bin/xdebug script or create a new bin/pcov script for example to enable/disable pcov.

Implementing pcov shouldn't be too difficult, and I'm happy to work on implementing the necessary changes to enable/disable the arguments as needed.

@markshust
Copy link
Owner

I don't have much experience with testing and Magento. Is it typical to run Xdebug when running integration tests? That doesn't seem right. I'd think it should always be disabled when tests are executed.

Perhaps you meant that with this line:

While xdebug and pcov are not compatible, it's straightforward to pass the arguments to enable/disable when needed.

...that the expected result is to disable Xdebug before the integration results are executed?

Copy link

dosubot bot commented Feb 6, 2025

Hi, @JesKingDev. I'm Dosu, and I'm helping the docker-magento team manage their backlog. I'm marking this issue as stale.

Issue Summary:

  • You proposed adding support for pcov to improve code coverage efficiency with PHPUnit.
  • YevhenZvieriev agreed, highlighting performance benefits in CI/CD pipelines and offered to assist with implementation.
  • Markshust questioned the typical use of Xdebug during integration tests and sought clarification on pcov and Xdebug compatibility.

Next Steps:

  • Please let me know if this issue is still relevant to the latest version of the docker-magento repository by commenting on this issue.
  • If there is no further activity, the issue will be automatically closed in 30 days.

Thank you for your understanding and contribution!

@dosubot dosubot bot added the stale Issue has not had recent activity or appears to be solved. Stale issues will be automatically closed label Feb 6, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
pending more info stale Issue has not had recent activity or appears to be solved. Stale issues will be automatically closed
Projects
None yet
Development

No branches or pull requests

3 participants