Chapter 3. Testing using canned responses

 

This chapter covers

  • The is response type, which is the fundamental building block for a stub
  • Using is responses in secure scenarios, with HTTPS servers and mutual authentication
  • Persisting your imposter configuration using file templates

During a famous U.S. White House scandal of the 1990s, then-president Bill Clinton defended his prior statements by saying “It depends on what the meaning of is is.” The grand jury and politicians ultimately failed to come to an agreement on the question, but, fortunately, mountebank has no uncertainty on the matter.

It turns out that is is quite possibly the most important, and the most foundational, concept in all of mountebank. Although an imposter, capturing the core idea of binding a protocol to a port, might beg to differ, by itself it adds little to a testing strategy. A response that looks like the real response—a response that, as far as the system under test is concerned, is the real response—changes everything. Is is the key to being fake. Without is, a service binding a protocol to a port is a lame beast at best. Adding the ability to respond, and to respond as if the service is the real service, turns that service into a genuinely useful imposter.

3.1. The basics of canned responses

3.2. HTTPS imposters

3.3. Saving the responses in a configuration file

Summary