Moco: An Enterprise Integration Response/Request Testing Tool
Join the DZone community and get the full member experience.Join For Free
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:
- Main page + Quick Start
- More Usages
- Detailed APIs
- Global Settings for multiple configuration files
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.
Opinions expressed by DZone contributors are their own.
RBAC With API Gateway and Open Policy Agent (OPA)
Mastering Time Series Analysis: Techniques, Models, and Strategies
Competing Consumers With Spring Boot and Hazelcast
Extending Java APIs: Add Missing Features Without the Hassle