Test Driven Development: How and Why
Test Driven Development(TDD) is a very useful approach towards code development. It keeps the developer from having to second guess every piece of code he writes. The TDD workflow goes like this: First, you write a block of code. Next, write a unit test for that block of code and ensure it passes. If there are any issues, refactor. This workflow also makes your design more intentional as it elucidates what the code is suppose to do. Each unit test is a test case and a grouping of tests makes up a test suite Unit tests should run on memory and not rely heavily on databases or even filesystems. It comes down to this: the behavior of the code is serving the original purpose intended by the developer. If there is suppose to an exception then code should raise it. Reduce risk it is the manifestation of the DevOps concept of 'Shifting Left. By discovering any issues to the left side of the Software Development Lifecycle(SDLC), the cost of fixing it is reduced. Unit tests will guard agai...