re: When do you write your tests? VIEW POST

re: Do you write pseudo code for the tests? Or are you thinking before you write your code that you know what will be there?

That's a good question. I usually follow a similar path as the one John mentioned, which is what TDD is all about from my perspective:

  1. Write down what behavior I expect the test to do, what dependencies it might need. (You can "write" it in your mind as well as long as there's a clear picture of what is needed).
  2. Then I write down the test to assert that behavior.
  3. And then the code.

TDD doesn't eliminate the need for design consideration, quite the opposite.
TDD is about design and that's why your question is very important - it's not just the notion of writing tests first and code later.

code of conduct - report abuse