title: Test-Driven Development - How to write a test before none of implementation code exists
body: <p>I'm learning TDD but struggling to adopt it as it's not straightforward.</p>
  
  <p>The question I cannot answer is "<strong>How to write a test before any of implementation code exists?</strong>". </p>
  
  <p>If our target class / target method / target parameter type / target return type don't exist, </p>
  
  <ul>
  <li>What do we refer to while writing code in the test. How do we start writing the test?</li>
  <li>How'd the test fail if all we could write is just the test method name before the actual implementation code?</li>
  </ul>
  
  <p><strong>Everybody tells WHY but not HOW</strong></p>
  
  <p>I've tried my best to find resources that elaborate on writing tests before production code but, assuming that I missed good resources, most of them are filled with cliches 
  explaining why TTD is important than focusing on practises to adopt it. </p>
  
  <p><strong>An example use-case.</strong></p>
  
  <p>Let's assume that we are developing a software for a University and our use-case is course registration. </p>
  
  <p>To keep it simple, let us confine this discussion to </p>
  
  <ul>
  <li>scenario : "A Student can enroll in a maximum of any 3 courses per semester"</li>
  <li>testing service layer and dao layer. </li>
  </ul>
  
  <p><strong>Pseudocode</strong></p>
  
  <pre><code>ENROLL(studentId, courseId)
      //check if student enrolled in less than 3 courses in the same semester as given courseId belongs in.
      //if yes, enroll him/her.
      //if not, return an error.
  </code></pre>
  
  <p>The actual implementation of above could span a couple of classes involving services, daos, etc.</p>
  
  <p>Please could you explain how to test-driven-develop it step by step?  If you were to implement this using TDD, how'd you do it step-by-step. </p>
  
  <p>I am hoping that this could aid many struggles like me in the future.</p>