WireMock.Net for HTTP Stubbing, Mocking, and Test Automation
WireMock.Net is a flexible product for stubbing and mocking web HTTP responses using advanced request matching and response templating. Based on WireMock Java, but extended and different functionality. Full documentation can be found at https://wiremock.org/dotnet/.
At a glance
- What is it?
- WireMock.Net is a C# and .NET library and standalone HTTP mock server based on WireMock Java. It serves C# unit and integration test teams that need request matching, response templating, proxy recording, stateful behavior, GraphQL, gRPC, OpenAPI, WebSockets, and CI/CD integrations, although the README does not provide a complete first-use walkthrough.
- Who is it for?
- C# teams that need deterministic HTTP collaborators should consider WireMock.Net when their tests can express behavior through mappings, matching rules, templates, or supported protocol integrations. Teams that need undocumented production-grade operation, unlisted platforms, or a proven deployment model should first inspect the project documentation and test their required HTTP, proxy, hosting, and upgrade paths.
- Can I use it commercially?
- Yes. Apache-2.0 is a permissive licence: you can use, modify and sell software built on it, as long as you keep its copyright and licence notices.
- Is it still maintained?
- Yes. The repository received new commits within the last day.
- What is it written in?
- Mainly C#, according to GitHub's language statistics.
Answers come from the project's GitHub data, last synced on October 23, 2026, and from our analysis. They are not legal advice.
Editorial analysis
What WireMock.Net Changes in .NET Tests
WireMock.Net addresses a specific problem in .NET testing: applications often need an HTTP endpoint that behaves differently from a real remote service. Instead of depending on that service during a unit or integration test, a test can configure a local or separately hosted mock that returns selected responses when a request satisfies selected conditions. The project describes this as HTTP response stubbing and mocking.
The intended users are developers writing C# tests, particularly teams that want to control an HTTP dependency at the boundary of the system under test. The README lists unit tests and integration tests as supported contexts. It also places WireMock.Net in local development and CI/CD scenarios, where a test process needs a predictable HTTP service that does not call an uncontrolled external system.
The feature set is broader than a simple static response map. Requests can be matched by URL or path, headers, cookies, and body content patterns. Responses can use Handlebars-based templating and extensions. The project also supports stateful behavior simulation, per-request conditional proxying, and record and playback of stubs. These features matter when a test needs to verify a sequence of calls, return request-derived values, or reproduce a dependency's behavior without changing the application under test.
The WireMock.Net Request and Response Architecture
The central mechanism is a mapping between an incoming HTTP request and a configured response. According to the README, matching can inspect URL or path, headers, cookies, and body content patterns. A mapping therefore acts as the decision point for the mock server: an incoming request is evaluated against configured conditions, and a matching request receives a configured response.
Responses are not limited to fixed payloads. Response templating and transformation are available through Handlebars and extensions. The documentation does not provide enough detail here to state the exact template variables or transformation pipeline, but the stated capability indicates that a response can incorporate data derived from the matched request rather than remain a constant.
WireMock.Net also has proxy behavior. The README lists record and playback of stubs, plus per-request conditional proxying. This supports a workflow in which selected requests are forwarded and recorded for later replay, while conditional proxying allows forwarding decisions to depend on request-level conditions. The project also supports stateful behavior simulation, which is a better fit than isolated fixed responses when a test must model transitions such as a resource changing state.
The library is not limited to ordinary HTTP. The README names GraphQL, gRPC and ProtoBuf, OpenAPI, OpenTelemetry, WebSockets, and Aspire distributed application testing. These are separate supported integration areas, but the excerpt does not define their configuration syntax or maturity, so those capabilities should be checked against the full documentation before depending on them in a test suite.
Choosing a WireMock.Net Package and Hosting Model
WireMock.Net is distributed as several NuGet packages, and the package choice affects how the mock is embedded or deployed. The README lists WireMock.Net, WireMock.Net.Minimal, WireMock.Net.StandAlone, WireMock.Net.Testcontainers, WireMock.Net.Aspire, WireMock.Net.AspNetCore.Middleware, WireMock.Net.AwesomeAssertions, and WireMock.Net.FluentAssertions. It also lists preview packages through MyGet, separate from the official NuGet packages.
The basic WireMock.Net package is described as usable in unit tests and integration tests. WireMock.Net.StandAlone corresponds to running the server as a separate process. WireMock.Net.Testcontainers targets container-based test environments, while the Aspire and ASP.NET Core packages address their corresponding hosting and integration scenarios. The README does not document compatibility ranges or package contents, so package selection should not be reduced to a visual comparison of names.
Configuration can use a fluent C# .NET API, JSON files, or JSON over HTTP. This gives teams more than one way to define mappings. A fluent API is likely to be natural for C# tests, while JSON files can make mappings easier to store or review as test data. JSON over HTTP is relevant when a test or client needs to alter a running mock server. The repository includes example projects for console applications, services, IIS, WebSockets, OpenTelemetry, proxying, OpenAPI parsing, Testcontainers, certificates, gRPC, and Aspire.
The deployment options are broader than a test library alone. The README states that WireMock.Net can run as a standalone process, a Windows service, Azure or IIS, or Docker. It also mentions JSON over HTTP, but the excerpt does not provide authentication guidance, exposed endpoints, or production-hardening instructions. Those omissions matter when a mock service is shared across machines.
A Practical First-Use Path Without Invented Setup Steps
The README does not include installation commands, a project file, a server startup command, or a complete first request example. It directs readers to the full documentation at https://wiremock.org/dotnet and identifies the NuGet packages listed above. Because the README contains no exact package version,.NET target framework, command, port, configuration file, or code sample, those details are intentionally not invented here.
The first practical path begins by identifying the package that matches the intended use. A team embedding a mock in tests would select the regular library package or the Minimal package after checking their package documentation. A team running a separate mock process would investigate WireMock.Net.StandAlone. A team using containers, Aspire, or ASP.NET Core middleware would use the corresponding package and consult that package's documentation for startup and lifecycle configuration.
The next step is to define one mapping using the fluent C# API, JSON file, or JSON over HTTP interface. The mapping should contain a request condition and a response, then the test should send an HTTP request that should match it. The expected result is the configured status, headers, and body, subject to the matching and templating features being used. The README confirms those configuration surfaces, but it does not show the method names or file schema.
This omission is a real documentation boundary. The project cannot be evaluated from the README as a copy-and-run tutorial. Teams should treat the official documentation, package page, and examples as required references when selecting the first package and writing the first mapping.
Limits of WireMock.Net as a Test Dependency
The largest limitation visible in the project description is that WireMock.Net simulates an HTTP-facing dependency, not the dependency's internal implementation. If a test depends on a particular database transaction, remote scheduling rule, authentication implementation, or domain invariant that is not represented by the request and response contract, a matching mock may produce a passing test without reproducing that behavior. Stateful simulation helps with sequences, but the README does not claim that every service behavior can be modeled.
There is also a configuration and maintenance cost. Mappings may live in fluent C# code, JSON files, or a running server's HTTP interface. A large fixture can therefore be spread across code, data files, and runtime configuration. Without a consistent convention, it becomes harder to see which mapping belongs to which test and what happens when two mappings match the same request. The excerpt does not document conflict resolution, priority rules, or fixture organization, so those points need direct verification.
The breadth of supported protocols creates another verification burden. GraphQL, gRPC, OpenAPI, OpenTelemetry, WebSockets, and Aspire support may be implemented through different packages and extensions. The README lists them, but it does not say that every package supports every hosting mode. It is also silent on rollback, compatibility between package versions, schema migration for JSON mappings, and the operational behavior of a shared server. Those are not minor details for a test service running in CI/CD.
WireMock.Net is also a poor fit when the test must prove behavior against the real service, including network behavior, certificates, redirects, performance, or upstream availability. A mock is useful for isolating tests, but isolation removes the exact dependency whose integration is supposed to be validated.
WireMock.Net Compared with a Simple In-Process HTTP Handler
A concrete alternative is an application-level fake implemented with an in-process HTTP handler or a small custom test server. That approach keeps the stub close to the test code and can be simpler when the application already exposes an injectable HTTP client. It does not require a separately running mock process, and it gives the test author direct control over the returned status, headers, and body.
WireMock.Net takes a different approach. Its mapping model is designed around incoming HTTP requests and configurable matching rules across URL or path, headers, cookies, and body content. It also exposes a standalone or hosted server model, JSON configuration, proxy recording and playback, conditional proxying, response templating, stateful behavior, and integrations for GraphQL, gRPC, OpenAPI, WebSockets, Aspire, OpenTelemetry, and Testcontainers.
The trade-off is scope. An in-process handler can be enough for a small unit test with one fixed response, while WireMock.Net adds server lifecycle, external configuration, protocol integrations, and proxy behavior. That extra machinery is useful when several tests or services need to share an HTTP contract, but it also adds package selection and configuration work. WireMock.Net is not automatically the better choice merely because it can run as a server. The deciding question is whether the test needs a configurable HTTP boundary rather than a direct replacement for one client call.
Licensing is comparatively simple to identify. The repository lists Apache-2.0. The license should still be reviewed in the repository's LICENSE file when it is incorporated into a product or distribution, particularly for notice, attribution, and redistribution requirements. No legal interpretation is made here.
Editorial conclusion
C# teams that need deterministic HTTP collaborators should consider WireMock.Net when their tests can express behavior through mappings, matching rules, templates, or supported protocol integrations. Teams that need undocumented production-grade operation, unlisted platforms, or a proven deployment model should first inspect the project documentation and test their required HTTP, proxy, hosting, and upgrade paths. WireMock.Net is a reasonable fit for test doubles when the documented package and hosting model match the project.
Frequently asked questions
What is WireMock.Net used for?
WireMock.Net is used to stub and mock web HTTP responses in C# unit tests and integration tests. It can match requests by URL or path, headers, cookies, and body content patterns, then return configured responses.
Does WireMock.Net support Docker and Aspire?
The README lists Docker as a hosting option and provides WireMock.Net.Testcontainers and WireMock.Net.Aspire packages. It also states that WireMock.Net can support Aspire distributed application testing, but the excerpt does not document the startup commands or configuration.
Can WireMock.Net record and replay HTTP stubs?
Yes. The README lists record and playback of stubs through proxying, as well as per-request conditional proxying. It does not specify the exact recording file format or API.
Official sources
Add this badge to your README
If you maintain this project, the badge below links readers to this analysis and shows its maintenance status from the daily GitHub snapshot. Paste the markdown into your README; add ?metric=license or ?metric=stars to the image URL for a different field.
[](https://hysenlabs.com/projects/wiremock-wiremock-net)Was this useful?