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 10. The Ten Commandments of Test Automation

In this last chapter, we're going to look at some of the learning we have found along the way, condensed in a format of Ten Commandments. As it is easier to learn high-quality coding looking at anti-patterns on what you should not do, in the same way it is easier to start writing good tests by telling what you shouldn't do. By adding restrictions on testing, you'll find your tests becoming purer and you will start writing test suites that are easier to maintain and provide more value.

Testing behavior, not implementation

// don't
[<Test>]
let ``should hash user password with SHA1`` () = 
    () // test body

// do
[<Test>]
let ``should hash user password to make it unreadable`` () =
    ()

Unless hash algorithm ...

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