WireMockInspect is a cross-platform UI app that facilitates WireMock troubleshooting.
WireMockInspector is distributed as dotnet tool
so it can be easily installed on Windows/MacOS/Linux
with the following command
dotnet tool install WireMockInspector --global --no-cache --ignore-failed-sources --add-source https://api.nuget.org/v3/index.json
After installation, you can easily run the app by executing wiremockinspector
command.
dotnet tool update WireMockInspector --global --no-cache --ignore-failed-sources --add-source https://api.nuget.org/v3/index.json
- Presents a list of requests received by
WireMock
server. - Combines request data with associated mapping.
- Presents a list of all available mappings with the definition
- Generate C# code for defining selected mappings
- WireMockServer settings editor
- Presents a list of all available scenarios along the details
- Visualise Scenario flow and current state
-
Install WireMockInspector dotnet tool
dotnet tool install WireMockInspector --global --no-cache --ignore-failed-sources
-
Install
WireMock.Net.Extensions.WireMockInspector
nuget packet to your test project -
Example usage in the code
using var wireMock = WireMockServer.Start(new WireMockServerSettings() { StartAdminInterface = true, Port = 9095 }); // Call Inspect() run WireMockInspect and attach it to the current WireMockServer instance wireMock.Inspect();
If you don't have an access to WireMockServer instance then you can call the extension method directly:
WireMockServerExtensions.Inspect("http://localhost:9095");
WireMockInspect offers two methods for generating C# code to create mappings, which is particularly useful when used in conjunction with the WireMock.NET proxy feature. The first method is accessible via the 'Code' tab for a selected mapping. Here, you can view the code provided by the endpoint http://localhost:9095/__admin/mappings/code/MAPPING_GUID:
The second method involves using the 'Code' tab for a selected request.
This approach employs a completely different mechanism for code generation. You can customize the generated code by using a custom liquid template:
- Download the default template and save it to your directory at
%LOCALAPPDATA%\WireMockInspector\templates\
. - Rename the file appropiately to reflect its purpose
- Modify the template according to your requirements.
- In the WireMockInspector, under the 'Show Options' section on the 'Code' tab, select your customized template from combo box.