Introduction to Integration Tests

Get familiarized with the basics of an integration test.

We'll cover the following

What is an integration test?

Integration tests are those tests that cover the integration of different components (be they external systems or various parts of an application).

Integration tests are fundamental to testing a system. Unit tests give us confidence that our functions and modules behave correctly, but we need to test that our system functions correctly as a whole, and to do that, we need to test the glue between the components of the system. This is where integration tests come in.


Let’s start by looking at an example of integration testing.

A common scenario is an HTTP-based web application with a router that routes requests to different functions based on the request URI. Those functions are usually contained in modules called controllers. A controller function is responsible for doing any necessary manipulation on the request data, formulating an output, and sending a response back to the client.

The code for the router and the controller could look something like this:

Get hands-on with 1200+ tech skills courses.