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 test is not complex

You should avoid complexity in your test at all costs. A few lines of straightforward workflow should be enough for arrange, act, and assert.

This means that we disallow the following in our tests:

  • Conditional statements such as if, match, and function
  • Looping constructs such as while, for
  • Additional types, interfaces, discriminated unions, or classes apart from the SU.
  • Threads
  • Exception handling, except asserting for thrown exceptions
  • Manipulation of lists, sequences, maps, or tuples

In short, your test should be as simple as the following steps:

  1. Set up the prerequisites to run the test.
  2. Run the test.
  3. Assert the result.

If anything else is needed, you probably have a too complex system that needs refactoring in order to bring down ...

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