Test driven development is a programming technique that emphasizes writing tests that will check the functionality of the application’s code before you actually write it into the development application. Explicit by the name, we will let the test drive our development. Basically, the idea is that, we write testing code before we start to write the REAL code and the only goal for our REAL code is to make the testing code pass. The basic 3 step process will be as follows:
1). Write a test that specifies a bit of functionality.
2). Ensure the test fails. (You haven’t built the functionality yet!)
3). Write only the code necessary to make the test pass.
So why do Test Driven Development or TDD? What do we gain from using TDD?
Here are 2 points:
1). When our tests pass without errors or failures, we can be certain that our application works just as we want it to—given that we wrote our tests well!
2). Second, by first setting the goal (the testing code) and then implementing it, it will make the coding a lot easier and concise. To understand the idea of TDD is extremely important.
Make sure you understand it, and then let’s start