From the course: Practical Test-Driven Development for Java Programmers

Unlock this course with a free trial

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

Good and bad tests

Good and bad tests

- [Instructor] Welcome back, we're now at chapter six, and in this chapter, we're going to talk about some of the best practice ideas to think about when you're deciding what tests you need to write. I hope that what we've done so far is relatively intuitive. Before we go any further, however, I think it's worth understanding what makes a good test. We won't be writing actual tests in this chapter, so you sit back and relax for a few minutes. Let's start by recapping that the iterable test driven development process requires the following three rules. We have to fail first. We always get a red bar before we write the real test. If you forget this step, you might think that a test is passing, when actually, it never ran in the first place. For the green step, we only write the minimum code needed to make that specific test pass, and then, we refactor as we go, both code and tests. We've actually not done much refactoring of our tests yet. There are some options for refactoring using…

Contents