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.
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.
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 are emulations of real services. Each has its own URI within the mock environment and can contain a several 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.
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.
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 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 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.