Test-driven development
In the software industry, there are two schools of thought with respect to when to write the test cases. One is test-driven development (TDD), and the other is to write tests when implementing the function flow.
In TDD, we first write a test and then write code to pass the test. Once the code passes the test, we refactor the code to make it optimized, and then use the test to make sure that the code does not break. With this approach, we are forced to think of all the conditions and alternate flows that can happen in our code, which in turn helps us write code that satisfies all the scenarios. But, it can become an overhead if you are developing an application that has a frequent change in requirements, because every ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access