April 23, 2018

Why mocktastic

Why we built mocktastic, why we use it and why you should use it too.

Never heard of Mocktastic before? Well, Mocktastic is a cross platform, downloadable, GUI desktop application, which allows you to easily mock up any REST API without having to write a single line of code. Anybody can create a mock API server, and then share it with their team, so the entire team can use it. Click here to know more!
Why mocktastic

We are the mocktastic team, and today we are going to be talking about why we built mocktastic. mocktastic is a cross-platform desktop application, which allows you to easily mockup and run REST APIs, enabling you to build and debug your client side code faster. It also has a ton of features to speed up your development and save you some effort. If you haven't checked it out yet, you should do it now!

So why did we build mocktastic?

We were working in a project that was basically a service which provided a front end for a backing REST API. Since we had tight deadlines, it was decided that we would simultaneously develop both the front-end and the backing REST API. The idea was that, we would build out the front-end for whichever parts of the API got built out and became available for us to play with.

This worked well for about 3 weeks. Since the APIs being implemented  were fairly complex, it took some time for each subset of endpoints to get ready. In comparison, the front-end client could be built in a pretty short time. Pretty soon we had a situation where all the front end guys would have short bursts of work, when an endpoint got built out, and were then whiling away their time waiting for the next one.

Eventually, in a bid to reduce time wasted, each front-end dev started mocking up expected responses from the API in their own code, and using that to build and test the front-end codebase.

This worked as long as there were no unexpected changes to the agreed upon API interface. But in the world of software, nothing gets implemented exactly as planned, and pretty soon we started having problems. There were situations where, as the APIs were being built out, they would change due to newly discovered implementation problems. Or maybe the client had suddenly remembered some requirement, which impacted half the API endpoints.

Whenever anything like this happened, the back-end developers had to email the expected changes in API endpoints and responses to the entire team, and based on that, the front-end devs would change their own mocked up responses, to get their work done.

This meant that everybody now had to keep an eye on their email for any of these changes, and had to stop whatever they were doing to change their mocks so that their work was up to date. This was cumbersome, and relied on too many people doing too many things. And too many cooks, generally spoil the broth.

To overcome these issues, we built out mocktastic as an internal tool, which would allow a back-end dev, to mock the entire range of endpoints, along with possible success and error responses, and share it with the entire team. Each front-end dev, would then just simply run the mock API server on their own machines, and hit that to build and test their features.

If any changes had to be made to the API, the back-end dev would make the updates, and then share the updated server again with the entire team. Each person who was running mocktastic, would then automatically have their mock server updated. This would eliminate the need to monitor emails, and keep interrupting the normal work flow to instead go an change the mocks.

The initial version of mocktastic that we built did not even have a GUI, it was just a command line tool! We only built a GUI, when a few of the devs started complaining about having to read an excessively long man page 😅 Even then, you had to open an archaic url in a browser window to get to the GUI.

mocktastic became quite popular within the office in a short while, and seeing the rapid rise in popularity, we decided to make it into a proper user friendly application. We spent the next couple of weeks polishing it up, packaged it into an Electron app, and released it to the world!

If you, or your team are facing similar issues, do have a look at mocktastic, it might come in handy for you. Also, since we are in beta right now, the team sync feature, which we are eventually planning to charge for, is currently free! So give it a shot, and tell us how your experience was!