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

Using ubiquitous language in your test name

Let us take a look at the following code:

// don't
[<Test>]
let ``store transaction to database`` () = 
    ()

// do
[<Test>]
let ``when customer checkout the cart, the order is persisted`` () =
    ()

Use words and expressions from the domain when expressing test names.

Getting the naming right is one of the hardest parts for the new tester. Before you know how to name your test, you need to know what to test, and before you know what to test you need to know what the feature is all about.

A good test name should state something about the feature, so obvious that a business analyst would agree with it. The test name should also reflect on what we're asserting.

In order to achieve this, I usually start my test names ...

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