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.

Testing code with dependencies

Testing code with dependencies

- [Instructor] Hello, welcome back. In this chapter, we're going to start on one of the more advanced techniques of test room development, which is how to test something where our code has a dependency on some kind of external system. That external system might be a database or a web service, for example. I need to just give a caveat that, in this part of the course, we're not going to be writing a complete set of unit tests for the functionality that we're building. That's just because I want to focus on specific aspects of the tests and building a complete suite of tests would be a lot of repetition of what we've already learned. Clearly, we don't want our test to actually access a database or call a web service. I hope the reasons for this are obvious. They include that the test might fail if the third-party system is down, and, of course, that's not a good reason for having a failing test. The test might not be repeatable if the data in the third-party system changes; and, also…

Contents