concept test datum in category microservice

appears as: test data, test data
Testing Microservices with Mountebank

This is an excerpt from Manning's book Testing Microservices with Mountebank.

This approach supports creating a laboratory environment for each test, in order to strictly control the inputs and dependencies of the service under test. However, it does make a couple of fundamental assumptions. First, it expects each test to start with a clean slate, which means that each test must remove the test data it added to prevent that data from interfering with subsequent tests. Second, the approach doesn’t work if multiple tests are run in parallel. Both of these assumptions fit nicely into automated behavioral tests, as test runners typically ensure tests are run serially. As long as each developer runs their own virtual service, you can avoid the resource contention that comes with concurrent test runs.

  • Capture the test data for each scenario.
  • Listing 10.1. Basic proxy response to capture test data
    {
      "responses": [{
        "proxy": {
          "to": "https://api.rescuegroups.org/",    #1
          "predicateGenerators": [                  #2
            { "matches": { "body": true } }         #2
          ]                                         #2
        }
      }]
    }
    
    Figure 10.5. Using a proxy to capture test data