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 the should
word, and let the fixture hold the name of the feature as follows:
when submitting the form.should warn about invalid e-mail address
when submitting the form.should store the user profile to database
The first...