Getting Started

Monster Mock is a service for mock API that has been designed to make your live easy on testing and protoyping applications.

Monster Mock has a full set of feautres configurations, including stub management, request advanced matching, fault injection, fake data creation and much more that you can gradually add to you mocked API.

And apart of that, Monster Mock mocks are 100% compatible with his OpenSource brother MMOCK https://github.com/jmartin82/mmock.

But let's start from the begining.

Create new account

To get your first mock API up and running you’ll need to start by creating a new account.

Once you’re in, you can create a new mock API by clicking new project button on the dashboard page.

New Project

A project represent the API you want to mock, and contains all stubs linked to this services.

A unique hostname under mmock.io will always be created when you save your new API but you can optionally specify a custom hostname to be created in addition. This must be unique within the context of mmock.io.

Once you’ve hit Save, you’re ready to create your first API stub.

Create new stub

Monster Mock is using his match engine to answer any request that recive with the corresponding and spected response.

This match can be done by thousands of convinations, like URL, headers, HTTP method, body and even using partial matchs with wilcards *.

To create your first stub just click in the "Create" button in your recently created project.

New Mock

In this dialog you can define the following data:

Request:

For the shake of simpicity we will create a stub for this call:

/hello?name={whatever}

Request information

Generated Response:

In the Response section, set HTTP status, headers and body text. Typically it is a good idea to send a Content-Type header in HTTP responses, so add one by clicking New header and setting Content-Type to application/json.

Response information

And click the save botton, that's all!

You always can copy paste the full stub definition in the JSON editor:

{ "description": "Hello my friend", "request": { "method": "GET", "path": "/hello" }, "response": { "statusCode": 200, "headers": { "Content-Type": [ "application/json" ] }, "body": { "greeting": "Hello {request.query.name}, my name is {fake.FirstName}" } } }

Test the new stub

Ok, let's see what we did.

You can test your first stub with the play button in your project page.

Play_button

Or, open your preferred browser and write the in the address bar the following address:

http://<subdomain>.mmock.io/hello?name=YOUR_NAME

You can find out your subdomain the project page.

You should see the text {"greeting": "Hello YOUR_NAME, my name is RANDOM_NAME"} on the response data.

Play_response

But let's investigate a bit more why that worked out.

Open the request page and look for the last request received.

Request_received

As you can see your browser request matched with the your stub.

But test now the address:

http://<subdomain>.mmock.io/no-hello

Now it's checking the request login it's easy to spot why this time didn't work.