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

Your test is a ninja

The reason that your test fails should be exact because it doesn't fulfill the promise of how the test is named. There should be no other reason for the test to fail, and it should be given no chance of failing because of anything else.

In many cases, we need to run a lot of code in order to get to the state that we want to test. This is a potential problem, because the code that we're passing through might fail and give us a failing test, but for a completely other reason than why the test was written. This is bad, because it makes the test suite hard to understand and hard to bug trace.

The only way to get around this problem is to limit the amount of code needed in order to run our tests, and that we can only do by refactoring ...

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