Test First or Test Driven development is a design pattern that can be summed up as:
Write a test case and fail it (RED)
~ This means create your unit tests referencing classes that do not exist
~ the project will not compilePut enough code to pass (GREEN)
~ This mean create the signature of the classes & methods you are testing (sometimes referred to as stubbing them out)
~ Return a default value, example if the return type is int then return 0Re factor (REFACTOR)
~ Implement the methods with the intended logic
~ Run test cases Pass/Fail
What is the value?
* High test coverage (You are forced to write Unit Tests)
* Intentions & requirements are clear
* Iterative development and testing
* Defects are identified early
* Automatic regression
Also see: https://dzone.com/articles/fail-fast-principle-in-software-development
References
- https://www.codeproject.com/Articles/560137/NET-TDD-Test-Driven-Development-by-example-Part
- https://stackoverflow.com/questions/793850/hello-world-the-tdd-way
- https://stackoverflow.com/questions/1365943/how-to-start-unit-testing-or-tdd
- https://stackoverflow.com/questions/3840125/useful-design-patterns-for-unit-testing-tdd
- https://mva.microsoft.com/en-us/training-courses/testdriven-development-16458?l=iCWHq6vXC_2706218965