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

Paratest is unstable and coverage retrieve different percentages each time I rerun tests #651

Closed
EARodriguez2021 opened this issue Jan 20, 2022 · 10 comments · Fixed by #655
Labels

Comments

@EARodriguez2021
Copy link

Q A
ParaTest version 6.4.1
PHPUnit version 9.5.11
PHP version 8.1.1

When I run tests, the percentage of the coverage is different

if I execute simple phpunit command, the percentage of my coverage is always the same. and after executing paratest, that percentage is different each time I rerun tests

@Slamdunk
Copy link
Member

Hi, I am aware of the bug, but need the time to investigate it

@EARodriguez2021
Copy link
Author

Thank you, I think this is a great library :)

@Slamdunk
Copy link
Member

Slamdunk commented Feb 4, 2022

I finally made it to create a self-contained small enough repo that shows the bug.

@EARodriguez2021 @maks-rafalko can you confirm the issue you're having is similar to https://github.com/Slamdunk/phpunit_codecoverage_bug#readme ?

@EARodriguez2021
Copy link
Author

Yes, @Slamdunk you're right, this is one of the main bugs that we experimented using different quantity of processes in the command executed because sometimes constants inside of an array are covered and suddenly same values are not covered without any logical reason. thank you for your valuable time you give us, we really appreciate it.

@Slamdunk
Copy link
Member

Slamdunk commented Feb 4, 2022

Thread continues at sebastianbergmann/php-code-coverage#889

@EARodriguez2021
Copy link
Author

Perfect, thanks

@Slamdunk
Copy link
Member

Slamdunk commented Feb 8, 2022

So, after for 4 days of digging the bug, there's a workaround: autoload the class with the constants in the test bootstrap.
Taking the first example of https://github.com/Slamdunk/phpunit_codecoverage_bug#readme a simple

// tests_bootstrap.php
class_exists(AType::class);

will get you to a consistent report of both tested and untested lines.

I have an idea on how to avoid this manual step, but in the meantime that's what I have for you

@EARodriguez2021
Copy link
Author

Excellent, thank you so much @Slamdunk that was a good solution

@Slamdunk
Copy link
Member

Stay tuned: sebastianbergmann/php-code-coverage#892 will likely solve the issue altogether 💪

@Slamdunk
Copy link
Member

v6.4.3 release now brings much more consistency between PHPUnit and ParaTest code coverage reports

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Development

Successfully merging a pull request may close this issue.

2 participants