Which technique isused in Test driven development? code example

Example 1: what is test driven development

In Test Driven Development Tests are created before actual code.
Than developers run the (UNIT) tests and Tests fail (because there is no code)
Than developer Write the code to pass the tests and Run the tests again.
Tests will PASS, against MVP(minimum viable product) code. 
lastly they REFACTOR YOUR CODE -> RE-DO ALL STEPS

Example 2: test driven development

Write tests. Run the code: it fails. 
because there is no code. Write code. 
Run the tests again: they will pass. Refactor, and re-do.

Tags:

Misc Example