14 Testing F# code

This chapter covers

  • When and when not to test your code
  • Making testable code
  • Basic unit testing
  • Working with NUnit-style testing frameworks
  • Property-based testing

This chapter focuses on writing automated tests of your F# code. There are entire books dedicated to unit testing, and I’m not going to try to cover everything in this chapter. Many (but not all) of the things you’ll read in those books still apply to F#, so as with other areas of the book, I’ll instead focus more on testing from an F#, FP-first perspective.

14.1 Automated tests: The value proposition

This section is a broad overview of the idea behind automated tests and how automated testing generally fits within the context of F#. Although I briefly covered the ...

Get F# in Action now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.