Mythbusting code coverage (while writing better code)

13:30 - 14:15 Lunar Back to event schedule

Code coverage is one of rare useful metrics that can measure your code. Yet, most of us get it completely wrong. Everyone knows that aiming for 100% coverage is crazy. So teams settle for some arbitrary figure they deem to be good enough. Most of teams aim for 80%, that's kind of an industry average. Excuse my party-breaking, but why? Why is it okay to have 20% of code untested? How do you decide which 20% not to cover? More often than not, it's the most complicated 20%, and most impactful 20%. For the better part of it, the 80% coverage is just a mantra. For some team, some time in the past, this figure made a lot of sense. But then it became one of those "best practices" that everyone follows, but nobody understands why anymore. The reason why it's okay not to test 20% of your code is not because it's your team's benchmark, but because that 20% of your code doesn't actually need testing. This session shows you how to structure your code in such a way that there is a very clear split between code that needs testing, and the code that you can safely omit from your unit tests. The end result is a much more robust, more testable code, and a good test coverage that is not just some meaningless number your team settled for.


Vjekoslav Babic

Solutions Architect | MVP

Vjekoslav Babić, or just Vjeko, is a Business Central architect, developer, trainer, author and blogger. With more than two decades of experience in the IT, he worked with vast range of technologies, but his passion has always been anything that had to do with the web and mobile worlds. Deep down, Vjeko is a hacker who took a long time to realize that the one thing he loves is writing code. He enjoys breaking things apart to see how they work. As a frequent speaker at conferences, in his demos, and his blog, he is pushes the limits of what's possible, connecting the world of Business Central with anything that can be plugged into it through some loophole or undocumented interface, especially if it's not meant to be used that way. Since spring 2010, Vjeko has been awarded the Most Valuable Professional (MVP) award for Microsoft Dynamics NAV. You can meet him at his blog "Vjeko.com - ideas in the cloud".