Testing Microservices with Mountebank
Brandon Byars
  • MEAP began March 2017
  • Publication in Spring 2018 (estimated)
  • ISBN 9781617294778
  • 275 pages (estimated)
  • printed in black & white
Testing Microservices with Mountebank is your guide to the ins and outs of testing microservices with service virtualization. Starting from your first test with mountebank you'll dive into testing with canned responses, using predicates, and recording and replaying behavior to your tests. Following real world use-cases you'll master the art of programming mountebank with your own dynamic responses and explore working with binary protocols. This book also explains using mountebank for load testing, in a continuous delivery pipeline, and more.
Table of Contents detailed table of contents

Part 1: First steps

1. Testing Microservices

1.1. A microservices refresher

1.1.1. Microservices and organizational structure

1.2. The problem with end-to-end testing

1.3. Understanding service virtualization

1.3.1. Approaches to service virtualization

1.3.2. Putting service virtualization in context

1.4. Introducing mountebank

1.5. Summary

2. Taking Mountebank for a Test Drive

2.1. Setting Up The Example

2.2. HTTP And Mountebank: A Primer

2.3. Virtualizing the Product Catalog Service

2.4. Our First Test

2.5. Summary

Part 2: using mountebank

3. Testing Using Canned Responses

3.1. The Basics of Canned Responses

3.1.1. The Default Response

3.1.2. Understanding how the default response works

3.1.3. Changing the default response

3.1.4. Cycling through responses

3.2. HTTPS imposters

3.2.1. Setting up a trusted HTTPS imposter

3.2.2. Using mutual authentication

3.3. Saving the responses in a configuration file

3.3.1. Saving multiple imposters in the config file

3.4. Summary

4. Using Predicates to Send Different Responses

4.1. The basics of predicates

4.1.1. Types of predicates

4.1.2. Matching object request fields

4.1.3. The deepequals predicate

4.1.4. Matching multi-valued fields

4.1.5. The exists predicate

4.1.6. Conjunction Junction

4.1.7. A complete list of predicate types

4.2. Parameterizing predicates

4.2.1. Making case-sensitive predicates

4.3. Using predicates on JSON values

4.3.1. Using direct JSON predicates

4.3.2. Selecting a JSON value with JSONPath

4.4. Selecting XML values

4.5. Summary

5. Adding record/replay behavior

6. Programming mountebank

7. Post-processing responses with behaviors

8. Working with binary protocols

Part 3: Closing the loop

9. Adding contract tests

10. Putting mountebank in a continuous delivery pipeline

11. Using mountebank for load testing

About the Technology

Microservices are independent, single-responsibility units of code that form a system with other microservices. It's difficult to test an individual microservice since each one depends on the other services. Mountebank solves this conundrum through service virtualization - imitating other components in the system so that you can test a microservice in isolation. Mountebank is the most capable service virtualization tool around, providing a programmable stand-in for a real dependency. As the only open-source virtualization tool with support for multiple protocols and scaling for load testing mountebank isn't snake oil; it's the cure-all for all your service virtualization needs.

What's inside

  • Approaches to service virtualization
  • Testing using canned responses
  • Programming mountebank
  • Understanding behaviors
  • Creating record / replay behavior
  • Adding contract tests

About the reader

Readers need programming skills and should be generally familiar with SOA or microservice systems.

About the author

Brandon Byars is a principal consultant at ThoughtWorks with long-standing experience in SOA and microservices. He is the author and chief maintainer of Mountebank and has helped multiple companies use it for testing a variety of systems.

Manning Early Access Program (MEAP) Read chapters as they are written, get the finished eBook as soon as it’s ready, and receive the pBook long before it's in bookstores.
MEAP combo $44.99 pBook + eBook
MEAP eBook $35.99 pdf + ePub + kindle

FREE domestic shipping on three or more pBooks