• (nodebb)

    It's worse than that, in fact. It doesn't test the toString method, since it doesn't look at what's returned. At best, it tests that it obeys the core contract of the methods, i.e. that they return something versus a NULL...

    It doesn't even verify that toString() returns a string, ffs.

  • (nodebb)

    assert(FRIST==FRIST);

  • Sauron (unregistered)

    TRWTF is that the project management office didn't see it coming, and just kept piling projects on the lead dev, with no fallback plan.

  • eluvatar (unregistered)

    Whenever someone mentions a code coverage target I always point out that I can meet that target without providing any value and I can write super valuable tests without getting anywhere near that target. Way more important to test useful things, but it's not like management would know what that looked like if it hit them square in the face.

  • WTFGuy (unregistered)

    The fact the lead's departure percolated up to the C-level says either the whole company is real small, or the PMO was essentially powerless and the mismanagement and extreme under-resourcing and overpromising goes all the way to the top. Which situation, though a major-league meta-WTF in itself, is so very common in our industry as to elicit nothing but a "Ho humm, move along, nothing to see here." reaction from me and I suspect from most of us. Which in turn is the meta-meta-WTF to rule them all.

  • (nodebb)

    Gee I wonder why the dev bailed.

  • (nodebb)

    that one developer's tasks were on every critical path on their Gannt chart

    Well there's your problem: they should try using Gantt charts instead.

    This keeps their code coverage metric pretty high

    How? Surely your coverage metric is the percentage of your code that is exercised by the tests. Unless the constructor, toString() and equals() methods are very large, the percentage is surely going to be close to zero.

  • (nodebb)

    Unless the constructor, toString() and equals() methods are very large, the percentage is surely going to be close to zero.

    Sort of, except that calling the boilerplate generated methods(1) will create a chunk of pointless "coverage", which boosts the percentage without actually adding much.

    (1) As I noted above, the calls don't actually test those methods, since the returns are not checked for correctness, unless two new blank objects should compare equal.

  • Kleyguerth (github)

    Fully agree with the easy reader version. I rather use snippets to generate boilerplate than "magic". "Magic" works wonders, until it doesn't...

  • Dave Aronson (github)

    Mutation testing would have caught those absolutely useless "tests". Y'all feel free to spread this meme I made:

    https://twitter.com/DaveAronson/status/1595077882199834624/photo/1

    And if you don't yet know about mutation testing, you can pick one of these conference talks of mine on it, of various lengths (and therefore depths): https://www.youtube.com/playlist?list=PLMrm16n64Bub8urB-bsyMyHiNPMLG7FAS

  • MaxiTB (unregistered)

    Ah, useless unit tests so that management can check something on their imaginary success list. Never gets old.

  • (nodebb)

    I hope they don't take test coverage percentage to be the minimum %'age of tests that pass in order for the build to be accepted.

  • Adam Ingerman (github) in reply to prueg

    No, no, the percentage of passing tests is only allowed to drop by 5% at a time...

  • (nodebb)

    "as that one developer's tasks were on every critical path on their Gannt chart. " - Root cause identified.

  • (nodebb) in reply to prueg

    I hope they don't take test coverage percentage to be the minimum %'age of tests that pass in order for the build to be accepted.

    To me it looks like they set a minimum code coverage for acceptance, combined with unrealistic deadlines. Then the dev started playing the metrics to meet the deadline or at least miss it by less.

    Who could ever have seen it coming?

  • Urs (unregistered)
    Comment held for moderation.
  • Airdrik (unregistered)
    Comment held for moderation.
  • nedalic142 (unregistered)
    Comment held for moderation.
  • سمارت بتس (unregistered)
    Comment held for moderation.
  • Anonymous Teacher (unregistered)
    Comment held for moderation.

Leave a comment on “Unit Test Coverage”

Log In or post as a guest

Replying to comment #:

« Return to Article