If you haven't checked out
https://doc.wikimedia.org/cover/, you should!
You can see what code is covered (and by which tests) and what code is not
covered if you want to generally improve test coverage.
Two things:
1) A coverage report like that, instead of just numbers showing the
relative change, would make it much easier to figure out what needs test
coverage but doesn't have it when submitting a patch to Gerrit.
2) From looking at the coverage reports, a pattern I've seen, at least in
the generally well-covered code I work with most, is that failure checks
are the general kind of code most likely to not be covered by tests,
especially the cases that are never supposed to happen, like something
being unexpectedly null, empty, or undefined.
My new unofficial (and somewhat inefficient) plan is to cover what I can
when I write new code, but expect test coverage to sometimes decrease. Once
the code is merged, and the test coverage report updates, I can find the
specific code branches that aren't covered and add more tests. It's not
efficient, but it does let you ratchet up the coverage over time much more
easily than before.
—Trey
Trey Jones
Sr. Software Engineer, Search Platform
Wikimedia Foundation
On Thu, Apr 26, 2018 at 3:02 PM, Daniel Kinzler <daniel.kinzler(a)wikimedia.de
wrote:
Hi all!
While I think it's great that CI is making sure that test coverage
improves, I'm
struggeling with making this work for me. It seems to me the stats that
are used
to detect test coverage are faulty, or at least unintuitive.
See for instance <https://gerrit.wikimedia.org/r/c/423146/10>. Please
explain to
me how this decreases test coverage
<https://integration.wikimedia.org/ci/job/mediawiki-phpunit-coverage-
patch/2480/console>.
What am I missing? As far as I can see, all new code has tests. I'm having
similar issues with several of my patches.
Also, am I correct in thinking that I could introduce a completely new
1000 line
class with no tests, and that would *not* be detected as decreasing
coverage,
since the new class didn't have any coverage before?....
--
Daniel Kinzler
Principal Platform Engineer
Wikimedia Deutschland
Gesellschaft zur Förderung Freien Wissens e.V.
_______________________________________________
Wikitech-l mailing list
Wikitech-l(a)lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/wikitech-l