Basic MockMotor Concepts

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

Non-HTTP-based protocols, such as SMTP or LDAP, are in MockMotor's plans.

MockMotor Instance

MockMotor instance is a server process that runs on a Linux or Windows box.

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

Mock Environments

Just like how a real environment consists of several real web services, a mock environment consists of mock services.

A mock environment is usually created by non-admin users for a project or release. The creator becomes the first owner who can add more owners to the environment.

All services within an environment share the same owners. The services within an environment also share the set of mock accounts and attachments (if any defined).

Below is an example list of mock environments (“Canada Post,” “DigitalOcean,” …).

Mock Services

Mock services are emulations of real services.

Each mock service has its own unique pair of ports (plain HTTP and HTTPS) and can contain several mock responses.

Below is a list of mock services located within an “Example Mock Services” mock environment:

You can see their port numbers (given in a smaller font) and the number of requests each service has handled.

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 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, the first element of the XML payload, XPath expressions, JSONPath expressions and Javascripts as well as combinations.

The response payload can be static XML or JSON or generated by an XQuery script or Javascript.

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

The response can also update the values of the selected mock accounts to support stateful tests.

How to Point Your Application to Mock

To point an application to a mock, you need to set the mock service URL in the application's configuration.

The mock service URLs are specified right under the service name. You can copy it by clicking on the copy icon to the left from the URL:

Mock services do not require any authentication.

However, if your service must work over HTTPS, you may need to either configure a valid certificate in the MockMotor instance settings or add MockMotor's self-signed certificate to the calling application trust.

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. account number in the request).

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


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's scripts to form its payload, HTTP status, delay, custom response headers and more.