A mock service simulates a real backend service. It has a unique URL and contains one or more mock responses.
All services available within an environment are listed on the environment Services page.
Each service has a name and a unique URL. You can also provide a generic description that provides some insights into what the purpose of this mock service is.
The environment URL is concatenated to the service URL to produce the full service URL. Above the environment URL is /SelfTest and the service URL is /AS, so the full service URL is /SeltTest/AS.
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, URL and (optionally) description and click “Save”:
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 “Add Service” from WSDL on the Services page:
Select WSDL from the disk and click “Import”:
In a short time, 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. However, these responses are by default configured to return a SOAP Fault:
You’ll have to provide your own payload and change the HTTP code to 200 before saving this.
Creating a New Mock Service from Swagger
You can create a new REST mock service by importing a Swagger file.
Click on “Add Service from Swagger” on the Services page:
Select the Swagger file from the disk and click “Import”:
MockMotor will create a new REST service:
Every operation in Swagger is encoded as a mock response, with a dummy response payload and HTTP status 500:
You will have to provide the payload and HTTP status:
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 URL with the target environment prefix URL:
MockMotor will also try to clone all the account properties that are used in the service responses.
Exporting Mock Service to ZIP
A service can be transferred to another MockMotor installation in a ZIP file.
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 Service from ZIP”:
Select the previously exported file and click “Import”:
The service will be imported and you’ll be redirected to the new Service page where you can modify its properties for the new environment: