Over a million developers have joined DZone.

Moco: An Enterprise Integration Response/Request Testing Tool

Visually compose APIs with easy-to-use tooling. Learn how IBM API Connect provides near-universal access to data and services both on-premises and in the cloud, brought to you in partnership with IBM.

Integrating test cases along with your applications can wreak havoc on the build process.  A different approach is usually required for testing integration points on your enterprise applications and today I came across a nifty open source tool that can possibly help alleviate some of that difficulty.

Moco, an open source tool created by Zheng Ye, is an "Easy Setup Stub Server" for testing network endpoints.  Essentially, all you need to write are two lines of code and you'll have your own HTTP server set up for simple request/response testing:

MocoHttpServer server = httpserver(50404);
server.response("howdy");


Pretty neat.  There's a lot more to it than just this.  You'll want to glance at these docs before you start using it so that you know its exact limitations:


Zheng says he was influenced by Mocketo and the Play! framework.  As for why he made it, I'll let him answer that:

Integration, especially based on HTTP protocol, e.g. web service, REST etc, is wildly used in most of our development.

In the old days, we just deployed another WAR to an application server, e.g. Jetty or Tomcat etc. As we all know, it's so boring to develop a WAR and deploy it to any application server, even if we use an embedded server. And the WAR needs to be reassembled even if we just want to change a little bit.

Give it a test drive or consider contributing to the project.

Visually compose APIs with easy-to-use tooling. Learn how IBM API Connect provides near-universal access to data and services both on-premises and in the cloud, brought to you in partnership with IBM.

Topics:

The best of DZone straight to your inbox.

SEE AN EXAMPLE
Please provide a valid email address.

Thanks for subscribing!

Awesome! Check your inbox to verify your email so you can start receiving the latest in tech news and resources.
Subscribe

{{ parent.title || parent.header.title}}

{{ parent.tldr }}

{{ parent.urlSource.name }}