{"id":37105188,"url":"https://github.com/alsritter/middlebaby","last_synced_at":"2026-01-14T12:41:41.351Z","repository":{"id":57654652,"uuid":"440511690","full_name":"alsritter/middlebaby","owner":"alsritter","description":"A mock testing tool for interfaces, used for interface debugging, interface self-testing, and automated testing.","archived":false,"fork":false,"pushed_at":"2022-11-18T03:09:44.000Z","size":23821,"stargazers_count":2,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2024-06-20T19:13:26.315Z","etag":null,"topics":["golang","grpc-mock","http-mock","interface-test","mock-server"],"latest_commit_sha":null,"homepage":"","language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"agpl-3.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/alsritter.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2021-12-21T12:37:05.000Z","updated_at":"2022-10-08T02:50:41.000Z","dependencies_parsed_at":"2022-09-01T06:02:45.053Z","dependency_job_id":null,"html_url":"https://github.com/alsritter/middlebaby","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/alsritter/middlebaby","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/alsritter%2Fmiddlebaby","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/alsritter%2Fmiddlebaby/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/alsritter%2Fmiddlebaby/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/alsritter%2Fmiddlebaby/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/alsritter","download_url":"https://codeload.github.com/alsritter/middlebaby/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/alsritter%2Fmiddlebaby/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28420814,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-14T10:47:48.104Z","status":"ssl_error","status_checked_at":"2026-01-14T10:46:19.031Z","response_time":107,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.6:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["golang","grpc-mock","http-mock","interface-test","mock-server"],"created_at":"2026-01-14T12:41:40.518Z","updated_at":"2026-01-14T12:41:41.338Z","avatar_url":"https://github.com/alsritter.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Middlebaby\n\nMiddlebaby is a tool for Mock services and interface testing of services under test\n\nTODO: Perfect README\n\nuse example see https://gitee.com/alsritter/testmb\n\n## Overview\nMiddlebaby is a tool for Mock services and interface testing of services under test\n\nMiddlebaby is committed to improving the work quality and efficiency of developers and testers, ensuring that the test quality reduces the test workload of service follow-up maintenance.With the help of tools, developers can get rid of the limitations of various dependencies in the self-testing stage, and quickly carry out interface availability verification and scene verification.Testers use tools to verify interface scenarios, and collaborate with developers to write and supplement interface test cases to improve collaboration efficiency and accuracy of information synchronization.\n\nMiddlebaby provides:\n* Mock MySQL and Redis Storage.\n* An easy way to create imposters files, using json\n* Configure response headers.\n* Configure CORS.\n* Run the tool using flags or using a config file.\n* TODO: ...\n\n## Installing\n\nSince it is built using Golang, so you can easily install it using `go install`\n\n```sh\ngo install github.com/alsritter/middlebaby@latest\n```\n\n## Using Middlebaby from the command line\n\nTODO: ...\n\n```\n$ middlebaby -h \na auto mock tool.\n\nUsage:\n  middlebaby [flags]\n  middlebaby [command]\n\nAvailable Commands:\n  completion  Generate the autocompletion script for the specified shell\n  help        Help about any command\n  init        init config file\n  serve       start the mock server\n\nFlags:\n  -h, --help      help for middlebaby\n  -v, --version   version for middlebaby\n\nUse \"middlebaby [command] --help\" for more information about a command.\n```\n\n\n## Using Middlebaby by config file\nuse Makfile.\n\n```sh\nmake run-http\n```\n\nThe config file must be a YAML file with the following structure.\n\n\n```yml\nlog:\n  prefix: true\n  level: debug\ntarget:\n  appPath: \"./target\"\nmock:\n  enableDirect: true\n  mockPort: 9090\ntask:\n  targetServeAdder: \"127.0.0.1:8011\"\n  closeTearDown: false\nstorage:\n  enabledocker: false\n  mysql:\n    enabled: true\n    port: \"3306\"\n    host: \"127.0.0.1\"\n    database: \"test_mb\"\n    username: \"root\"\n    password: \"123456\"\n    local: \"Asia/Shanghai\"\n    charset: \"utf8mb4\"\n  redis:\n    enabled: true\n    port: \"6379\"\n    host: \"127.0.0.1\"\n    auth: \"123456\"\n    db: 0\ncase:\n  taskFileSuffix: .case.json\n  caseFiles: \n      - \"./tests/cases/**/*.case.json\"\n  watcherCases: true\n  mockFiles:\n      - ./tests/http.mock.json\n  watcherMock: true\nproto:\n  protoimportpaths: []\n  sync:\n    enable: false\n    storagedir: \"\"\n    repository: []\nweb:\n  port: 6060\n```\n\nhttp mock file\n\n```json\n[\n  {\n    \"request\": {\n      \"protocol\": \"http\",\n      \"method\": \"GET\",\n      \"host\": \"example.org\",\n      \"path\": \"/get\",\n      \"params\": {\n        \"name\": \"John\",\n        \"age\": \"55\"\n      }\n    },\n    \"response\": {\n      \"status\": 200,\n      \"header\": {\n        \"Content-Type\": [\"application/json\"]\n      },\n      \"body\": \"{\\\"name\\\":\\\"John\\\",\\\"color\\\":\\\"Purples\\\",\\\"age\\\":55}\",\n      \"trailer\": {},\n      \"delay\": {\n        \"delay\": 100,\n        \"offset\": 50\n      }\n    }\n  },\n  {\n    \"request\": {\n      \"protocol\": \"http\",\n      \"method\": \"GET\",\n      \"host\": \"https://example02.org\",\n      \"path\": \"/get\"\n    },\n    \"response\": {\n      \"status\": 200,\n      \"header\": {\n        \"Content-Type\": [\"application/json\"]\n      },\n      \"body\": \"{\\\"name\\\":\\\"Alice\\\",\\\"color\\\":\\\"Blue\\\",\\\"age\\\":18}\",\n      \"trailer\": {},\n      \"delay\": {\n        \"delay\": 300,\n        \"offset\": 200\n      }\n    }\n  }\n]\n```\n\nhttp task cases\n\n```json\n{\n  \"protocol\": \"http\",\n  \"serviceMethod\": \"GET\",\n  \"serviceName\": \"Test access to the Mock's external service\",\n  \"serviceDescription\": \"This is the first test service\",\n  \"servicePath\": \"http://localhost:8011/example\",\n  \"serviceProtoFile\": \"\",\n  \"setup\": [\n    {\n      \"typeName\": \"\",\n      \"commands\": []\n    }\n  ],\n  \"mocks\": [\n    {\n      \"request\": {\n        \"protocol\": \"http\",\n        \"method\": \"GET\",\n        \"host\": \"example.org\",\n        \"path\": \"/get\",\n        \"query\": {\n          \"name\": [\"John\"],\n          \"age\": [\"55\"]\n        }\n      },\n      \"response\": {\n        \"status\": 200,\n        \"header\": {\n          \"Content-Type\": [\"application/json\"]\n        },\n        \"body\": \"{\\\"name\\\":\\\"John\\\",\\\"color\\\":\\\"Purples\\\",\\\"age\\\":88}\",\n        \"trailer\": {},\n        \"delay\": {\n          \"delay\": 300,\n          \"offset\": 50\n        }\n      }\n    }\n  ],\n  \"teardown\": [\n    {\n      \"typeName\": \"\",\n      \"commands\": []\n    }\n  ],\n  \"cases\": [\n    {\n      \"name\": \"first case-fail\",\n      \"description\": \"Test cases that will fail~\",\n      \"setup\": [],\n      \"mocks\": [],\n      \"request\": {\n        \"header\": {},\n        \"query\": {},\n        \"data\": null\n      },\n      \"assert\": {\n        \"response\": {\n          \"data\": {\n            \"name\": \"John\",\n            \"color\": \"Purples\",\n            \"age\": 55\n          }\n        },\n        \"otherAsserts\": []\n      },\n      \"teardown\": []\n    },\n    {\n      \"name\": \"first case-success\",\n      \"description\": \"\",\n      \"setup\": [],\n      \"mocks\": [\n        {\n          \"request\": {\n            \"protocol\": \"http\",\n            \"method\": \"GET\",\n            \"host\": \"example.org\",\n            \"path\": \"/get\",\n            \"query\": {\n              \"name\": [\"John\"],\n              \"age\": [\"55\"]\n            }\n          },\n          \"response\": {\n            \"status\": 200,\n            \"header\": {\n              \"Content-Type\": [\"application/json\"]\n            },\n            \"body\": \"{\\\"name\\\":\\\"John\\\",\\\"color\\\":\\\"Purples\\\",\\\"age\\\":55}\",\n            \"trailer\": {},\n            \"delay\": {\n              \"delay\": 300,\n              \"offset\": 50\n            }\n          }\n        }\n      ],\n      \"request\": {\n        \"header\": {},\n        \"query\": {},\n        \"data\": null\n      },\n      \"assert\": {\n        \"response\": {\n          \"data\": {\n            \"name\": \"John\",\n            \"color\": \"Purples\",\n            \"age\": 55\n          }\n        },\n        \"otherAsserts\": []\n      },\n      \"teardown\": []\n    },\n    {\n      \"name\": \"first case-regex-success\",\n      \"description\": \"\",\n      \"setup\": [],\n      \"mocks\": [\n        {\n          \"request\": {\n            \"protocol\": \"http\",\n            \"method\": \"GET\",\n            \"host\": \"example.org\",\n            \"path\": \"/get\",\n            \"query\": {\n              \"name\": [\"John\"],\n              \"age\": [\"55\"]\n            }\n          },\n          \"response\": {\n            \"status\": 200,\n            \"header\": {\n              \"Content-Type\": [\"application/json\"]\n            },\n            \"body\": \"{\\\"name\\\":\\\"John\\\",\\\"color\\\":\\\"Purples\\\",\\\"age\\\":55}\",\n            \"trailer\": {},\n            \"delay\": {\n              \"delay\": 300,\n              \"offset\": 50\n            }\n          }\n        }\n      ],\n      \"request\": {\n        \"header\": {},\n        \"query\": {},\n        \"data\": null\n      },\n      \"assert\": {\n        \"response\": {\n          \"data\": {\n            \"name\": \"@regExp:^J.*\",\n            \"color\": \"Purples\",\n            \"age\": 55\n          }\n        },\n        \"otherAsserts\": []\n      },\n      \"teardown\": []\n    },\n    {\n      \"name\": \"first case-js-success\",\n      \"description\": \"\",\n      \"setup\": [],\n      \"mocks\": [\n        {\n          \"request\": {\n            \"protocol\": \"http\",\n            \"method\": \"GET\",\n            \"host\": \"example.org\",\n            \"path\": \"/get\",\n            \"query\": {\n              \"name\": [\"John\"],\n              \"age\": [\"55\"]\n            }\n          },\n          \"response\": {\n            \"status\": 200,\n            \"header\": {\n              \"Content-Type\": [\"application/json\"]\n            },\n            \"body\": \"{\\\"name\\\":\\\"John\\\",\\\"color\\\":\\\"Purples\\\",\\\"age\\\":55}\",\n            \"trailer\": {},\n            \"delay\": {\n              \"delay\": 300,\n              \"offset\": 50\n            }\n          }\n        }\n      ],\n      \"request\": {\n        \"header\": {},\n        \"query\": {},\n        \"data\": null\n      },\n      \"assert\": {\n        \"response\": {\n          \"data\": {\n            \"name\": \"@regExp:^J.*\",\n            \"color\": \"Purples\",\n            \"age\": 55\n          }\n        },\n        \"otherAsserts\": [\n          {\n            \"typeName\": \"js\",\n            \"actual\": \"assert.data.statusCode == 200\",\n            \"expected\": true\n          },\n          {\n            \"typeName\": \"js\",\n            \"actual\": \"assert.data.data.color == 'Purples'\",\n            \"expected\": true\n          }\n        ]\n      },\n      \"teardown\": []\n    }\n  ]\n}\n```\n\n## How to use\n\nTODO: ...","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Falsritter%2Fmiddlebaby","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Falsritter%2Fmiddlebaby","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Falsritter%2Fmiddlebaby/lists"}