From the course: Test-Driven Development in C++

Unlock this course with a free trial

Join today to access over 22,600 courses taught by industry experts.

Test-driven development best practices

Test-driven development best practices - C++ Tutorial

From the course: Test-Driven Development in C++

Test-driven development best practices

- [Instructor] There are a lot of things you can do to help with your practice of unit testing and test-driven development. In this lecture, I'll go over some of the best practices that I have found are essential to making test-driven development productive. You should always do the next simplest test case. This allows you to gradually increase the complexity of the code, refactoring as you go. This helps keep your code clean and understandable. If you jump to the complex cases too quickly, you can find yourself stuck writing a lot of code for one test case which breaks the short feedback cycle we look for with TDD. Beyond just slowing you down, this can also lead to bad design as you can miss some simple implementations that come from the incremental approach. Always use descriptive test names. Code is read thousands of times more than it's written as the years go by. Making the code clear and understandable should be the top priority. Unit tests are the best documentation for the…

Contents