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

Always test in isolation

A good test is one that is completely confined within the function where it is defined. The state of the test suite and the state of the system are the same after the test has run, as it was before.

When tests are not isolated, you start to get maintenance and reliability problems. The most common refactoring that developers do on their test suite is to share setup between tests. It is common that tests share much of the setup code, but instead it should be considered a waste. Instead, we need to investigate how we can refactor the SUT in order to avoid excessive and repeatable tests setup. Once we've done this, we will end up with better tests and better-designed SUT.

Tests need not only to be isolated from each other by ...

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