Part 2. Using mountebank
The test in chapter 2 was a behavioral test, but service virtualization can satisfy a wide spectrum of testing needs. Understanding how mountebank fits into that spectrum requires exploring the full capabilities of the tool.
The test we just looked at used basic building blocks of service virtualization—and indeed of any stubbing tool—the ability to evaluate the request to determine how to respond. We’ll look at these capabilities over the course of the next two chapters, including additional context around HTTPS, managing configuration files, and taking advantage of mountebank’s built-in XML and JSON parsing.
Chapters 5 and 6 demonstrate more advanced response generation, allowing a more interesting set of test scenarios. By adding record and replay capability, you can generate test data dynamically to perform large-scale tests and to build the foundation for performance testing (which we’ll examine in part 3). The ability to programmatically change responses gives you key flexibility to support hard-to-test scenarios like OAuth.
Behaviors, or postprocessing steps, provide advanced functionality. From managing test data in a CSV file to adding latency to your responses, behaviors give you a robust set of tools both to simplify testing and to support a wider range of testing scenarios. We explore behaviors in chapter 7.