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

Tests that break occasionally

One of the most common test smells are tests that break from time to time. Sometimes you have a test that breaks once and then never again. Other tests will always fail the first time and then succeed when they're rerun. It often happens that you write a test that will work perfectly now but fail sometime in the future.

When it comes to unit testing, this kind of test smell is quite rare. Since your unit tests should operate on memory only, there are few things that would make the test fail occasionally. One thing would be threading. A race condition is always the kind of test that would break when the CPU cycles don't perform in the expected order. This could cause the test to fail even though it is a unit test.

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