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
After installation, you can easily run the app by executing wiremockinspector
command.
dotnet tool update WireMockInspector --global --no-cache --ignore-failed-sources
WireMock
server.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:
1) Download the default template and save it to your directory at %LOCALAPPDATA%\WireMockInspector\templates\
.
2) Rename the file appropiately to reflect its purpose
3) Modify the template according to your requirements.
3) In the WireMockInspector, under the 'Show Options' section on the 'Code' tab, select your customized template from combo box.