{"id":37041593,"url":"https://github.com/vincent-scw/mock-it-up","last_synced_at":"2026-01-14T04:55:05.406Z","repository":{"id":37375025,"uuid":"331496113","full_name":"vincent-scw/mock-it-up","owner":"vincent-scw","description":"Mock It Up is a mock server for testing purpose.  It supports both static and dynamic stubs consist of http request/response.","archived":false,"fork":false,"pushed_at":"2022-07-01T08:09:40.000Z","size":265,"stargazers_count":9,"open_issues_count":0,"forks_count":1,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-09-27T22:19:17.493Z","etag":null,"topics":["integration-testing","mock","mock-server"],"latest_commit_sha":null,"homepage":"","language":"C#","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/vincent-scw.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2021-01-21T02:51:18.000Z","updated_at":"2023-05-09T20:14:34.000Z","dependencies_parsed_at":"2022-09-14T21:10:40.333Z","dependency_job_id":null,"html_url":"https://github.com/vincent-scw/mock-it-up","commit_stats":null,"previous_names":[],"tags_count":2,"template":false,"template_full_name":null,"purl":"pkg:github/vincent-scw/mock-it-up","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/vincent-scw%2Fmock-it-up","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/vincent-scw%2Fmock-it-up/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/vincent-scw%2Fmock-it-up/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/vincent-scw%2Fmock-it-up/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/vincent-scw","download_url":"https://codeload.github.com/vincent-scw/mock-it-up/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/vincent-scw%2Fmock-it-up/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28409900,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-14T01:52:23.358Z","status":"online","status_checked_at":"2026-01-14T02:00:06.678Z","response_time":107,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"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":["integration-testing","mock","mock-server"],"created_at":"2026-01-14T04:55:04.979Z","updated_at":"2026-01-14T04:55:05.392Z","avatar_url":"https://github.com/vincent-scw.png","language":"C#","funding_links":[],"categories":[],"sub_categories":[],"readme":"![CI/CD](https://github.com/vincent-scw/mock-it-up/actions/workflows/docker-image.yml/badge.svg)\n\n# mock-it-up\n***Mock It Up*** is a mock server for testing purpose. It supports both ***static*** and ***dynamic*** stubs consist of http request/response.\n\n## Install\n* Install server\n```docker \ndocker pull edentidus/mockitup\ndocker run -p 5000:5000 -p 30000:30000 edentidus/mockitup\n```\n* Install client (C#)\n```\nInstall-Package MockItUp.Client\n```\n\n## Motivation\nIn microservice architecture, a serviec might denpendent to multiple other services by Restful Http requests. When doing acceptence/integration test, it is very annoying to connect to real downstream services. Trying to decoupe the dependencies, ***Mock It Up*** is a mock server to replace the real services.\n\n![img](/design.png)\n\n## Prepare for testing\n* ***Static*** stub should be registered as spec files before server started. \n  ```yml\n  version: v1\n  stubs:\n    - request:\n        method: get\n        path: api/orders/{id}\n      response:\n        body: order.json\n        delay: 100\n    - request:\n        method: put\n        path: api/orders\n      response:\n        statusCode: 201\n        body: |\n          {\n              \"id\": 1000,\n              \"customerId\": \"${b.customer.id}\"\n          }\n  ```\n  For details, please refer to [Static Stub Wiki](https://github.com/vincent-scw/mock-it-up/wiki/Static-Stub).\n* ***Dynamic*** stub should be registered within a test scenario. It will be removed automatically when scenario disposed.\n  ```csharp\n  using (var scenario = _client.BeginScenario())\n  {\n      var orderId = 215;\n      // Register a dynamic stub to mock server\n      var regResult = scenario.RegisterDynamicStub(stub =\u003e\n          stub.WhenRequest(\"GET\", \"api/orders/{id}\")\n              .RespondWith(JsonConvert.SerializeObject(new\n              {\n                  id = orderId,\n                  title = \"this is a test\"\n              }))\n      );\n\n      // Do your testing against real service\n      var response = await httpClient.GetAsync($\"{_orderUrl}/api/orders/{orderId}\");\n      var order = await ReadResponseAsync\u003cdynamic\u003e(response.Content);\n\n      Assert.Equal(orderId, (int)order.id);\n      Assert.Equal(\"this is a test\", (string)order.title);\n\n      // The stubs in current scenario will be removed in dispose\n\n      // You can also manually remove any stubs within current scenario by\n      // scenario.RemoveDynamicStubs(regResult.StubID);\n  }\n  ```\n  For details, please refer to [Dynamic Stub Wiki](https://github.com/vincent-scw/mock-it-up/wiki/Dynamic-Stub). \n* Both ***dynamic*** and ***static*** stubs can work together. Mock It Up try to match the dynamic stub, then static. Please run tests synchronously to aviod collision.\n* Before running docker containers, don't forget to copy your specs and payloads into container if you want to use ***static*** stubs.\n* Idealy, running acceptence/integration test requires three containers -- Service, Tests and Mock Server-- working together. \n  * Run with docker-compose: ```docker-compose up --abort-on-container-exit --exit-code-from integrationtest```.\n  * Run in K8S: Include ***Mock It Up*** as a sidecar together with api service.\n* For more URL match examples, please refer to [Tests](https://github.com/vincent-scw/mock-it-up/blob/development/test/MockItUp.UnitTest/Core/StubItemTest.cs).\n  \n## Config the mock server\nWhen start, ***Mock It Up*** reads settings via configuration file. Please ref to [config.yml](https://github.com/vincent-scw/mock-it-up/blob/main/test/MockItUp.IntegrationTest/mockitup.d/conf.yml)\n| Property | Required? | Default Value |Notes                                                                    |\n|----------|-----------|---------------|-----------------------------------------------------------|\n| host     | required  | \u0026ast;         | Use 'localhost' in Windows for debugging                |\n| services | required  | { *: 5000 }   | Add services by key:value (name:port) pair               |\n| controlPort | required for dynamic | 30000 | dynamic only                                        |\n| specDirectory | required for static | /etc/mockitup.d/specs/ | The url path to spec directory (static only)   |\n| payloadDirectory | optional | /etc/mockitup.d/payloads/ | The url path to payload (definition of response bodies) directory (static only) |\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fvincent-scw%2Fmock-it-up","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fvincent-scw%2Fmock-it-up","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fvincent-scw%2Fmock-it-up/lists"}