Mock a dependency without VPN
Goal: your micro calls a core you don’t want (or can’t) launch. You mock it: MicroLab responds for it with what you define.
1. Resolve the dependency as “mock”
Section titled “1. Resolve the dependency as “mock””In the scenario’s Dependencies panel, set that dependency to mock. From then on, your micro’s calls to that core are handled by MicroLab’s mock server.
2. Define the response
Section titled “2. Define the response”You have two paths, depending on whether you prefer to get ahead or react:
Proactive (from OpenAPI). In the Mocks section, create a stub for that service. If it declares OpenAPI, select the operation and MicroLab generates a body template; if not, you write it by hand. See Mocks section.
Reactive (from a real call). Launch the scenario and let your micro call. The request appears in the Mock calls dock; turn it into a stub with one click and edit it. See Mock calls dock.
3. Adjust variants
Section titled “3. Adjust variants”An endpoint can have several variants (a 200, a 500, with latency…). The one
that is served is marked with the toggle. Changes apply with hot reload: you don’t
need to restart anything.
Without launching
Section titled “Without launching”You can check what a mock would respond without launching the scenario: in the CLI,
microlab mock probe <method> <path>.