Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
After generating code coverage reports with
./vendor/bin/phpunit --coverage-html ~/d8CodeCoverage/
I see some of what we report is nonsense :-
For example the report states there is zero test coverage for the file EntityViewControllerTest.php
Test classes by definition cannot have tests!
It also makes no sense to talk about code coverage for the 89 files that end *TestBase.php
Beta phase evaluation
Issue category | Bug fix /Feature... it brings the code coverage report closer to reality, that is it drastically reduces the stated number of classes without test coverage! |
---|---|
Issue priority | Normal |
Unfrozen changes | This not a code change |
Disruption | No disruption |
Comment | File | Size | Author |
---|---|---|---|
#12 | interdiff-10-12.txt | 525 bytes | martin107 |
#12 | test-2458487-12.patch | 531 bytes | martin107 |
#10 | interdiff.txt | 524 bytes | martin107 |
#10 | test-2458487-10.patch | 530 bytes | martin107 |
#2 | test-2458487-2.patch | 530 bytes | martin107 |
Comments
Comment #1
martin107 CreditAttribution: martin107 commentedRewrote issue summary.
Supplied working patch
Comment #2
martin107 CreditAttribution: martin107 commentedWhen I now inspect the code coverage report I see these files with the follow suffix
*TestBase.php
have floated to the top of the zero test coverage tables. Which is again gibberish
find . -name '*TestBase.php' | wc -l
tells me that there are 89 files we should also be ignoring for test coverage.
Comment #3
martin107 CreditAttribution: martin107 commentedComment #4
dawehnerWhat do you think about excluding vendor itself?
Comment #5
martin107 CreditAttribution: martin107 commentedWhat about vendor ....I think we have that covered.
Looking at the coverage report ... I see the top level directories.
1) core
2) modules
3) sites
when I descend into core
My choices are
lib
module
vendor is excluded.
but back to the top level I can lookup the code coverage for
drupal/sites/default/default.settings.php
- so that is wrong .. but a minor correction as we are only talking about a handful a php files.
hundred of files have been excluded by the patch as it stands...
Its getting late ... I will fix that up tomorrow..
Comment #6
dawehnerMh, I have seen vendor being in there at some point. Never mind.
Comment #7
martin107 CreditAttribution: martin107 commentedI woke up this morning thinking, yeah I must have missed it, it got to still be in there....
The project risk section should be used to highlight crappy code.
Suppose our biggest risk is in the vendor section I think that is something we need to know.
Someday we are going to need to swap out our own heartbleed thing...
I am planning to look at this wealth of data some more ... we can alway discuss the vendor thing in another issue:)
PS
Just wanted to clarify what I said above for vendor subdirectories the code complexity measure is a valid indicator ...the test coverage metric will not be.
Comment #8
martin107 CreditAttribution: martin107 commentedAdd beta evaluation.
Comment #9
Wim Leerss/defintion/definition/
"by … tests." suggests it's a proper phrase, which means "by" should really be "By".
Both can be fixed upon commit.
Comment #10
martin107 CreditAttribution: martin107 commentedThanks ... Ah it is my mess I should clean it up :)
Comment #11
Wim LeersStill … s/defintion/definition/
:P
Comment #12
martin107 CreditAttribution: martin107 commentedMore haste less speed....
martin107--
Comment #13
Wim LeersPerfect now. No worries, happens to all of us :)
Comment #15
alexpottCommitted f76c925 and pushed to 8.0.x. Thanks!
Thanks for adding the beta evaluation to the issue summary.
Comment #18
Mile23This issue is a regression against #2056607: /core/phpunit.xml.dist only finds top-level contrib modules leading to #2498531: phpunit_example tests not discovered in the commandline
Please let's revert this and find another solution so that contrib works.
Comment #19
Mile23And here's a new issue: #2499239: Use test suite classes to discover different test types under phpunit, allow contrib harmony with run-tests