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

Chapter 4. Unit Testing

Unit testing is the art of designing your program in such a way that you can easily test each function as isolated units and such verify its correctness. Unit testing is not only a tool for verification of functionality, but also mostly a tool for designing that functionality in a testable way. What you gain is the means of finding problems early, facilitating change, documentation, and design.

In this chapter, we will dive into how to write good unit tests using F#:

  • Structuring your tests
  • Testing in isolation
  • Finding the abstraction level
  • Test doubles
  • Dependency injection
  • Dealing with databases

After reading this chapter, you will be able to write high-quality unit tests that will require little maintenance and stand the 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