With my current role involving a long train journey, I have taken the opportunity to re-read Kent Beck's Test-Driven Development, By Example. Its one of my favourite technical books, and manages to provide a lot of useful information in quite a small tome. Although the examples are in Java and Python (both of which I have no experience of) I have no problem following them at all. I highly recommend it to anyone who is learning or using TDD.
The book contains many ideas on how to implement and apply TDD, some of which I had forgotten. One such forgotten idea is Assert First. The idea is that when you are writing a test method, the first thing you should write is the Assert statement. You can then work backwards from here to act and then arrange your test. It has a beautiful symmetry with the test first philosophy.
I've been using Assert First quite a lot recently and have found it a very useful addition to my toolbox. It is particularly useful when you are writing the first test of a fixture and are unsure of how to proceed. Many times, in this situation, you know what the results should be but don't know how to get there. Assert first allows you to express your results and then rapidly work towards the solution with confidence.
Inside RavenDB 4.0 book–Chapter 4 & 5 are done
16 hours ago