title: How is it possible to write unit test before write source code?
body: <p>As the unit test is a white box test, it assumes that you must know in advance all the cases your code must treat, all the client objects  (aka Mock object in the test) your code must deal with, and the correct order in which client objects  must appear in the code (since unit test take in account the calling of mock object). In other words you must know exactly the detailed algorithm of your code. Before you can exactly know the algorithm of your code you must write it first!  </p>
  
  <p>From my point of view I don't see how it's possible to write correct unit test before writing source code. Nevertheless it's possible to write functional tests first since functional tests are sort of user requirement.
  Your advice?
  Best regard</p>
  
  <p><strong>AN EXAMPLE IS GIVEN FOR THIS QUESTION:</strong><br>
  <a href="https://stackoverflow.com/questions/14538910/how-to-write-test-code-before-write-source-code-when-they-are-objects-dependenci">How to write test code before write source code when they are objects dependencies?</a></p>