O'Reilly logo

Testing with F# by Mikael Lundin

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

The false security of code coverage

When doing test automation, you can use a tool that will tell you how large a part of your code is covered by tests. This may seem like a good idea at first glance, but does have some hidden dangers.

The following image shows the code coverage tool, NCover:

The false security of code coverage

The code coverage report will show you what code was traversed and how many times, but it's a false assumption that the report will tell you what was tested. How many times is it required that a test pass a line of code in order to call it covered? Consider the following example:

open NUnit.Framework open FsUnit // System Under Test let rec fibonacci = function ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required