Narrow Integration Tests

In this module, you’ll learn how to use narrow integration tests to drive the development of low-level infrastructure wrappers. You’ll build HttpClient, an infrastructure wrapper for HTTP-based services.

Concepts

Download the slides and transcript here.

Direct links to patterns discussed in this module:

Primers

You may wish to familiarize yourself with these primers before starting on the exercises:

Exercise Setup

Start with the Overall Setup. Then:

1. Check out the code

  1. Check out the exercise branch:
    • JavaScript: git checkout narrow-integration-tests-js
    • TypeScript: git checkout narrow-integration-tests-ts
  2. Create a custom branch for your changes:
    • git checkout -b my-narrow-integration-tests

2. Prepare to start working

  1. Open the exercise files:
    • src/node_modules/http/_http_client_test.js (or .ts)
    • src/node_modules/http/http_client.js (or .ts)
  2. Run the build watcher from the root of the repository:
    • Windows: .\watch.cmd quick
    • Mac/Linux: ./watch.sh quick
  3. Confirm that the build runs and ends with BUILD OK.

Exercises

The course is designed to have more exercises than you can finish in a single session, so don’t worry about finishing everything. Instead, work at your own pace and focus on understanding the material.

  1. Challenge #1: Listening
  2. Challenge #2: Stopping
  3. Challenge #3: Requests
  4. Challenge #4: Responses
  5. Challenge #5: Request Data
  6. Challenge #6: Response Data
  7. Challenge #7: Introducing Assertions
  8. Challenge #8: The Spy Server
  9. Challenge #9: The Last Request
  10. Challenge #10: Set the Response
  11. Challenge #11: Production Code
  12. Challenge #12: Happy Path
  13. Bonus Challenges

Start with Challenge #1

Return to course overview