8

Integration Testing

WHAT'S IN THIS CHAPTER?

  • How integration tests are different from unit tests and why integration tests are important
  • Why it's important to start writing and running integration tests early
  • How to write an automated integration test with NUnit and where the practice deviates from writing unit tests with NUnit
  • What end-to-end tests are and why they are critical to the success of an application development effort
  • How to manage the external resources that are used by integration and end-to-end tests
  • When and how integration and end-to-end tests should be run

The point of unit tests in TDD is to drive the development of discrete components and sections of an application. To that end, it's important to keep the unit tests and the code they exercise isolated from other components or external resources. In fact, tests that test the same unit of functionality should be isolated from each other. This means that these tests can be run in any order or combination and produce the same predictable results. This is necessary to ensure that the application's individual components are being developed in a simple, loosely coupled, and complete manner. The isolation of unit tests also makes it easier to diagnose and correct defects that cause tests to fail.

There comes a time, however, when an application's components must be combined. Ensuring that these various parts come together correctly is the job of integration tests. Integration tests verify that the various components ...

Get Professional Test-Driven Development with C#: Developing Real World Applications with TDD now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.