Mockenize is a small application for web mocks generation, is very fast and easy to use. It has several features that support the simulation of various web scenarios, including timeout, random response, logs of calls and a friendly UI. Mockenize is also open source, contribute if you want!
How to use
- Running the server
java -jar mockenize-server-x.x.x.jar --server.port=8090 (default port is 8080)
- You can use with docker too!
docker run -itd -p 8080:8080 mockenize/mockenize-server
- Adding basic mocks
POST http://localhost:8080/_mockenize/mocks
{
"path" : "/foo/bar",
"method" : "POST",
"status" : 202,
"body" : "Response success!!!",
"headers" : {
"Content-Type" : "text/plain"
}
}
- Adding multiple responses mocks. The responses will return at sequential.
POST http://localhost:8080/_mockenize/mocks
{
"path" : "/foo/bar",
"method" : "POST",
"values" : [
{
"status" : 202,
"body" : "Response success!!!",
"headers" : {
"Content-Type" : "text/plain"
}
},
{
"status" : 500,
"body" : "Response fail!!!",
"headers" : {
"Content-Type" : "text/plain"
}
}
]
}
- Adding multiple aleatory responses mocks. The return responses at random.
POST http://localhost:8080/_mockenize/mocks
{
"path" : "/foo/bar",
"method" : "POST",
"random" : true,
"values" : [
{
"status" : 202,
"body" : "Response success!!!",
"headers" : {
"Content-Type" : "text/plain"
}
},
{
"status" : 500,
"body" : "Response fail!!!",
"headers" : {
"Content-Type" : "text/plain"
}
}
]
}
- Using timeout response. (5 seconds)
POST http://localhost:8080/_mockenize/mocks
{
"path" : "/foo/bar",
"method" : "POST",
"timeout" : 5,
"status" : 202,
"body" : "Response success!!!",
"headers" : {
"Content-Type" : "text/plain"
}
}
- Using interval timeout response. (5 at 10 seconds)
POST http://localhost:8080/_mockenize/mocks
{
"path" : "/foo/bar",
"method" : "POST",
"minTimeout" : 5,
"maxTimeout" : 10,
"status" : 202,
"body" : "Response success!!!",
"headers" : {
"Content-Type" : "text/plain"
}
}
- Clearing all mocks.
DELETE http://localhost:8080/_mockenize/mocks/all
- Clearing unique or multiple mocks.
DELETE http://localhost:8080/_mockenize/mocks
[
{
"path" : "/foo/bar",
"method" : "POST"
},
{
"url" : "/my_second_url/test",
"method" : "GET"
}
]
- Use the admin to easily create your mocks.
http://localhost:8080/_mockenize/admin/index.html
Developed by Mauricio Lima & Rodrigo Watanabe