In chapter 6, we discussed unit testing in Rust. In this chapter, we’ll discuss how to use integration testing in Rust, and how it compares to unit testing. Both unit testing and integration testing are powerful strategies to improve the quality of your software. They are often used together with slightly different goals.
Integration testing can sometimes be a little more difficult because it may require more work to create harnesses and test cases, depending on the type of software being tested. It’s more common to find unit tests than integration tests, but Rust provides the basic tools you need to write effective integration tests without spending too much time on boilerplate and harnesses. We’ll also explore some libraries that can help turbocharge your integration testing without requiring much additional work.