2011/6/22 laurent laffont
<laurent.laffont@gmail.com>
IMO having the expected value before is the right way ! Do you TDD ? It makes a lot of sense for me to write assert: expected equals: actual. Am I alone ?
I practice TDD, and I start tests with assertions (after naming them). But I'm not sure I specify expected value first, as I'm focused on the result (I write the test for).�Btw, I use Mocketry and exploit its sugar (or DSL?) for specifications there. So, I write:
That is, after I've decided on a test case and named it, I think: what should I test? That's the actualValue. I name and write it. And only after that, I think about the value it should have� well, in most cases at least.
Anyway, I'm not sure an order I use to write assertion should be repeated by assertion messages. Just as order I use to write a�test (name -> assertion -> the way to fetch the actual value -> �) is not reflected by test code. It's much more important to have a readable and understandable (after many months) code. And for me it's much more natural to read it this way:�