Mock Services

A mock service simulates a real backend service. It contains one or more mock responses.

A service has a unique pair of HTTP and HTTPS ports for addressing it in client applications.

All services available within an environment are listed on the environment Services page.

Service Properties

Each service has a few configurable properties:

Name: a human-readable name
Description: an optional more lengthy explanation of the purpose of the mock
Plain HTTP port: a port this service listens on. This port has no encryption.
HTTPS port: a port this service listens on. This port has TLS 1.2 encryption and presents MockMotor identity certificate (set in Settings)
CORS: when set to Auto and there are CORS headers in the request, MockMotor generates the response CORS headers automatically.
Forwarding URL: if no mock response in the service matches the request, the request is sent to a live backend instead.
Record Mocks: if set to Yes, create new mocks from responses received from the forwarding URL.

Creating a New Mock Service

Creating a New Empty Mock Service

To create a new empty mock service, click on Add Service on the Services page:

Populate the service name and optionally description.

You don't have to fill in the port numbers. MockMotor selects the next available pair on saving.

Click Save.

MockMotor assigned a pair of ports to the new service and opened them.

The newly created empty service won't have any responses defined yet. You'll have to add them manually.

Creating a New Mock Service from WSDL

You can create a new SOAP mock service in an environment by importing its WSDL.

Click on Import from WSDL on the Services page:

Select WSDL from the disk and click Import:

The current version of MockMotor doesn't support the loading of WSDL from the network. Please download WSDL to your local disk before importing it.

A new mock service is created, and its properties are pre-populated.

Update these properties if required and click Save:

MockMotor creates a single response for each operation from the provided WSDL.

These responses are configured to return a SOAP Fault. The generation of schema-valid responses is planned for future versions.

You should update the payload, response status and the delay for the operations you need to mock.

Creating a New Mock Service from OpenAPI (aka Swagger)

You can create a new REST mock service by importing an OpenAPI file.

Click on “Import from OpenAPI” on the Services page:

Select an OpenAPI file from the disk and click Import:

MockMotor creates a new REST mock service:

Every operation in OpenAPI is recorded as a mock response, with a dummy response payload and HTTP status 500.

The generation of JSON schema-valid responses is planned for future versions.

You have to provide the payload, HTTP status and the delay for responses you need to mock:

Cloning Mock Service to Another Environment

A service can be cloned to another environment.

Click on the Clone to Environment button on the Service page.

Select the target environment and click Clone:

The new cloned service gets the new set of ports:

MockMotor also tries to clone all the account properties that are used in the service responses.

Transferring Mock Service to Another Instance

When you need to transfer a service that works well in on MockMotor instance to another (for example, SFT to PTE), you can export it as a ZIP file from one instance and then import it to another.

Exporting Mock Service to ZIP

To export a service, click the Export as ZIP button on the Service page.

Save the ZIP file from the download dialog.

Importing Mock Service from ZIP

The previously exported service can be imported into another MockMotor installation.

To import a service, go to the Service page and click Import from ZIP:

Select the previously exported file and click Import:

The service is imported, and you'll be redirected to the new Service page where you can modify its properties.

Note that MockMotor assigns a new pair of port numbers to the service.