I was watching this great recording from last year on how programmers should think. It talks a lot about the importance of writing a specification for your code.
The specification may be a comment and also be more or less formal. One thing that I'm missing using tests as the executable specification for your code. The presentation is covering formal specifications that can be verified by a machine yet it is the fact that (unit) tests can be used as executable specification. At least that is how I view them.
But still the most important takeaway from the talk is that you need to write your specification before you code. Hence if tests are viewed as specifications rather than tests it is obvious when you write them.