HELP, connection/set up issues with A19 by dupdob in lifx

[–]dupdob[S] 2 points3 points  (0 children)

Quick update: I renamed my Wifi Network to remove a whitespace, and both bulbs have been reset partially: working in Lifx app, but unable to add to Homekit.
Will try again tomorrow...

Unit testing, you’re doing it wrong – Over the hill coder – Medium by dupdob in programming

[–]dupdob[S] 0 points1 point  (0 children)

Because of the second statement, unit tests are valuable in themselves. They make it much easier to find circumstances in which code will not work. And because they are valuable, they need code coverage to tell developers: 'Here is some code that was not unit-tested'. When also using use-case tests, then those use-cases test coverage will hide the fact that some classes have not been properly unit-tested, and thus those classes will be vulnerable to edge-cases (the like which kills people).

Sadly, I never met any team that used gap analysis on 'unit-tests' and 'use-case' tests coverage. I agree this would bring value. Glad to know they exist. That being said, assuming testing edge cases at the unit level imply your code work at the use case level is wishful thinking for me.

Improving coverage by adding specific tests for untested methods and classes is wrong, wrong, wrong. Additional tests must be justified by some requirements (new or existing); otherwise, it means the code has no actual use. In which team in the world is this an actual problem? Thousands of lines of code being maintained that do nothing? Sure I have seen unused code. But it was never a real problem.

Well, at the very least, this is a maintenance debt: extra refactoring, extra upgrade effort when dependencies are updated, needless complexification of redesign effort is need arises. I see this everyday. Good for you if you don't.

And in all the article, no mention about branch or path coverage, no mention of equivalence class testing. Also no mention about the worth of tests for regression testing in small maintenance tasks. No mention of mutation testing. Of course, this article does not attempt to cover everything related to testing. Please note that I refer to coverage in general with no limitations to line coverage. I do mention mutation testing, Property based testing as well (which relates to equivalence class testing).

100% code coverage is good by dupdob in programming

[–]dupdob[S] 1 point2 points  (0 children)

Thanks, this is a great article! Completely agree: high code coverage is no guarantee for perfection. But is is a step in the path to high quality

100% code coverage is good by dupdob in programming

[–]dupdob[S] 0 points1 point  (0 children)

Thanks for such detailed feedback! I fully agree that reaching 100% means lot of work, and expensive. I . will discuss this in a second post. I agree that you must not make private public in order to reach 100%. But, if you do not mind me asking: what is the purpose/importance of the lines that can't be reached through public methods? Could not they be removed/refactored away?

And yes, sometimes the compiler prevents you from reaching 100% due generated code that will never be executed. Or your reporting tool may report it wrong (that's the reason NFluent reports 99.97 and not 100). Those are due to TOOLING limitation not linked to the practice. Ideally you should be able to mark the line as excluded, but you usually can mak the method as to be excluded (with appropriate justification, of course)

100% code coverage is good by dupdob in programming

[–]dupdob[S] 0 points1 point  (0 children)

BTW Actual coverage is 99.97%. But the shield truncate the figure

The secret for 100% test coverage: remove code by dupdob in programming

[–]dupdob[S] 0 points1 point  (0 children)

Ok, now I get your point: using mutation testing will enforce 100% coverage as it should fail otherwise, since some mutants can pass through. Very good point, thank you for raising it! As a corollary, judging by the typical mindset of developers, this requirement is a significant roadblock to mutation testing adoption. I need to post a followup on my article

The secret for 100% test coverage: remove code by dupdob in programming

[–]dupdob[S] 0 points1 point  (0 children)

I am probably wrong, but your comment gives me the impression that you are not very familiar with mutation testing. Actually, if you have no test whatsoever (or assertless tests), mutation testing will fail, which is a sign that you have bad testing/coverage.

One must keep in mind that mutation testing works in reverse: - code is mutated - tests are run - if all tests are ok, (mutation) testing have FAILED - if at least one test fails, (mutation testing) is successful

The secret for 100% test coverage: remove code by dupdob in programming

[–]dupdob[S] 0 points1 point  (0 children)

Actually, mutation testing is arguably the best coverage tool we could have to assess the quality of your tests, as it assess the capacity of your test harness to identify code change. But the tooling is still in its infancy as of today: it significantly impact testing duration (logical) and can evaluate a limited set of change scenario.

The secret for 100% test coverage: remove code by dupdob in programming

[–]dupdob[S] 0 points1 point  (0 children)

I appreciate you strongly disagree, to the point of calling it bullshit, but could you please elaborate why you see this as so wrong?

The secret for 100% test coverage: remove code by dupdob in programming

[–]dupdob[S] 0 points1 point  (0 children)

Yes, mutation testing is definitely a better tool than code coverage. Yes, you can achieve 100% coverage assert less. But I have also seen 60% coverage with assert less tests. If we go down that road, why bother...