Basic MockMotor Concepts

MockMotor is a mock engine for web services, including SOAP, REST and even plain HTTP.

Presently, MockMotor cannot mock non-HTTP-based protocols, such as SMTP or LDAP. However, this is in MockMotor’s future plans.

MockMotor Instance

One MockMotor instance can listen on one plain HTTP port and one HTTPS port. It has its own web UI which is available through the same ports.

A single MockMotor instance can support a large number of mock environments.

Mock Environment

Just like how a real environment consists of a number of real web services, a mock environment consists of mock services. All services within a mock environment share the same URL prefix and mock accounts.

A mock environment is usually created by non-admin users for a project or release.

Mock Services

Mock services are emulations of real services. Each has its own URI within the mock environment and can contain a several mock responses.

Mock Responses

Mock responses are scripted responses within a mock service. A single response is selected for every incoming request based on request properties.

Each mock response in a service is tried in turn until a match for the request is found.

MockMotor can match a response with a request using the HTTP Method, relative URI, SOAPAction header, first element of the XML payload, XPath expressions, JSONPath expressions and Javascripts as well as combinations.

Typically, there is one or a few mock responses per service operation. It is possible to have one response per account but this is not recommended - use mock accounts instead.

The response payload can be static XML or JSON, XQuery script or Javascript.

Response properties, such as HTTP status, delay and HTTP headers can also be specified as static values or be scripted.

To support stateful tests, the response can also update the values in the selected mock accounts.

Mock Accounts

Mock accounts are similar to real accounts in real environments. Every mock account is a set of key-value properties, where a key can be account number, current balance or any other value that can affect the script-generated responses.

Accounts (one or more) can be selected for specific response based on the request properties (e.g. request account number).

Accounts are typically bulk-edited via Excel downloads and uploads. They can also be updated by the response script to support stateful scenarios.

Variables

Variables hold various context values during the request execution.

Some variables contain values from the incoming request, some from the selected accounts and some even have metainformation about the service, responses and ready-to-use random values.

Variables are available to response scripts to form its payload, HTTP status, delay, custom response headers and more.