The unit test is coded first before a single line of code is written. Writing the test first is much less efficient than writing the code first. The reason for this is that testing involves baggage. What this means is that if some test cases exist for a component and some significant changes need to be made to that component, then the test cases will probably have to be changed as well. This usually requires significant extra time and effort. If the test cases have not been written yet, then there is no baggage and no changes have to be made to test cases because they don’t exist yet.
When writing the test first, the emphasis has changed from focusing on the code and coming up with the best design and implementation to meet the requirements to focusing on the tests.
This practice also encourages overly simplistic methods that lead to a poor overall design, bloated code, and makes it harder to maintain.