# integration testing

## Unit testing recap

While we were unit testing we tested all the components ***individually***. Piecing all those individual tests together we get all the way from the start to the final call the SendGrid client. We were looking for the way our code would respond to different inputs - we were not trying to test SendGrid's code.

When we got to the mailer function we did not want to actually call SendGrid and send a real email, so we mocked the entire SendGrid client with Mockito (below)

![](/files/-MirS1w6jz498LBLFzzu)

## Integration view

Now we want to test all our components together as a whole, and cover as much of the end to end functionality as possible, but we still don't want to actually call SendGrid and send a real email, and we want to create scenarios that would be difficult to re-create with a real production API.

So we use Wiremock to "mock" the SendGrid API. Wiremock provides the capability to return anything th SendGrid API might return without having to set up each specific scenario. And we won't ever accidentally call the real API and send an email.

![](/files/-MirS1w7t_IoNtRD_l_S)


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://chris-lomeli.gitbook.io/tiny-engines/sandbox/sendgrid-mailer-intro/003-integration-testing-overview.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
