当前位置: 首页 > 软件库 > 云计算 > >

WireMock.Net

授权协议 Apache-2.0 License
开发语言 C#
所属分类 云计算
软件类型 开源软件
地区 不详
投 递 者 龙霖
操作系统 跨平台
开源组织
适用人群 未知
 软件概览

WireMock.Net

A C# .NET version based on mock4net which mimics the functionality from the JAVA based WireMock.org.

For more info, see also this WIKI page: What is WireMock.Net.

Key Features

  • HTTP response stubbing, matchable on URL/Path, headers, cookies and body content patterns
  • Library can be used in unit tests and integration tests
  • Runs as a standalone process, as windows service, as Azure/IIS or as docker
  • Configurable via a fluent DotNet API, JSON files and JSON over HTTP
  • Record/playback of stubs (proxying)
  • Per-request conditional proxying
  • Stateful behaviour simulation
  • Response templating / transformation using Handlebars and extensions
  • Can be used locally or in CI/CD scenarios

Info

Project  
  Chat
  Issues
Quality  
  Build Azure
  Quality
  Sonar Bugs
  Coverage

NuGet packages

Official Preview
  WireMock.Net NuGet Badge WireMock.Net MyGet Badge WireMock.Net
  WireMock.Net.StandAlone NuGet Badge WireMock.Net MyGet Badge WireMock.Net.StandAlone
  WireMock.Net.FluentAssertions NuGet Badge WireMock.Net.FluentAssertions MyGet Badge WireMock.Net.FluentAssertions
  WireMock.Net.Matchers.CSharpCode NuGet Badge WireMock.Net.Matchers.CSharpCode MyGet Badge WireMock.Net.Matchers.CSharpCode
  WireMock.Net.OpenApiParser NuGet Badge WireMock.Net.OpenApiParser MyGet Badge WireMock.Net.OpenApiParser
  WireMock.Net.RestClient NuGet Badge WireMock.Net.RestClient MyGet Badge WireMock.Net.RestClient
  WireMock.Org.RestClient NuGet Badge WireMock.Org.RestClient MyGet Badge WireMock.Org.RestClient

Development

For the supported frameworks and build information, see this page.

Stubbing

A core feature of WireMock.Net is the ability to return predefined HTTP responses for requests matching criteria.See Wiki : Stubbing.

Request Matching

WireMock.Net support advanced request-matching logic, see Wiki : Request Matching.

Response Templating

The response which is returned WireMock.Net can be changed using templating. This is described here Wiki : Response Templating.

Admin API Reference

The WireMock admin API provides functionality to define the mappings via a http interface see Wiki : Admin API Reference.

Using

WireMock.Net can be used in several ways:

UnitTesting

You can use your favorite test framework and use WireMock within your tests, seeWiki : UnitTesting.

As a dotnet tool

It's simple to install WireMock.Net as (global) dotnet tool, see Wiki : dotnet tool.

As standalone process / console application

This is quite straight forward to launch a mock server within a console application, see Wiki : Standalone Process.

As a Windows Service

You can also run WireMock.Net as a Windows Service, follow this WireMock-as-a-Windows-Service.

As a Web Job in Azure or application in IIS

See this link WireMock-as-a-(Azure)-Web-App

In a docker container

There is also a Linux and Windows-Nano container available at hub.docker.com.For more details see also Docker.

HTTPS / SSL

More details on using HTTPS (SSL) can be found here Wiki : HTTPS

  • 目录 介绍 背景 使用代码 兴趣点 从 GitHub下载完整的源代码 介绍 如果您是执行TDD的ASP.NET Core开发人员,您可能会遇到一些问题。您的测试不涵盖您的Program类和Startup类。您的模拟框架有助于模拟内部依赖项,但不能模拟外部依赖项,例如其他公司制作的Web服务。此外,也许您决定不测试某些类,因为要模拟的内部依赖项太多。在本文中,我将解释如何解决这些问题。 背景 如果您

  • WireMock 是一个灵活的库用于 Web 服务测试,和其他测试工具不同的是,WireMock 创建一个实际的 HTTP服务器来运行你的 Web 服务以方 便测试。 支持 HTTP 响应存根、请求验证、代理/拦截、记录和回放。 你可以去github上面下载最新版本的wiremock https://github.com/tomakehurst/wiremock 如果只要使用不用源码可以直接下载s

  • (一)Jar包下载与启动 1.这里使用了wiremock-standalone-2.19.0.jar 这个版本的依赖包,到相应的下载目录 2.直接用命令启动   java -jar wiremock-standalone-2.19.0.jar -port 9999 -verbose -verbose的意思是输出日志 启动之后会在当前目录下面生成两个文件夹,一个__files 另外一个 mappin

  • 上一节课中给大家介绍了如何搭建 WireMock 服务并模拟了一个简单的 Get 请求接口。为了后续在学习接口测试过程中能模拟各种类型的接口,本次课程将带领大家学习如何通过 WireMock 模拟更复杂的接口,为了完成本次课程目标,我将课程内容拆分成了两个小的 Task: Task1:模拟 JSON 格式的接口 Task2:模拟 XML 格式接口 模拟 JSON 格式接口 模拟一个接口,总的来说就