Part of Anarchy I/O Toolkit, a .NET developer platform · Pillar: Infrastructure · Layer: Web · Package catalog

A browser UI for Anarchy.Toolkit.Web.MockServer, built on Anarchy.Toolkit.Web.Ui: see what the mock server answers with and what it received while your tests or application run.

dotnet add package Anarchy.Toolkit.Web.MockServer.Ui
  • Expectations: every loaded, code and runtime expectation with its method, path, status, priority, remaining times and source, as JSON on demand; reloads the expectation files.
  • Requests: the received requests, live, with what answered them, filterable and viewable as JSON; clears them.
  • Middlewares: the plugged-in middlewares, in pipeline order.
  • Logs: a live tail of the server’s in-memory log, whatever the console verbosity, filterable by level and text.

When to use it

When developing against a mock server, or debugging a failing integration test, and reading the console is not enough. Use Anarchy.Toolkit.Web.MockServer alone when no one looks at it, e.g. in CI.

How to use it

Run it standalone, like the plain mock server (same arguments), and open http://localhost:6001/__mock/ui/:

dotnet Anarchy.Toolkit.Web.MockServer.Ui.dll -e "mocks/**/*.json"

Or call UseUi() from a host of your own:

return await MockServerEntryPoint.RunAsync(args, server => server
    .AddExpectationsFrom("mocks")
    .UseMiddleware<FakeAuthMiddleware>()
    .UseUi());
  • The URL is printed in the startup banner. It lives under /__mock, so it is never matched against expectations nor recorded as a received request.
  • --no-ui (or MOCKSERVER_UI=false) turns it off without changing the host. The Anarchy IMockServerBuild targets take --mock-server-ui false, and the Make targets UI=false, e.g. make mock_server_start UI=false.
  • It has no login: it is meant for local and test environments, like the control API.
  • UseUi(path) serves it elsewhere under the same rules.

Releases

See the release notes for the complete release history.