wiremock 基本docker 运行

Posted rongfengliang

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了wiremock 基本docker 运行相关的知识,希望对你有一定的参考价值。

使用docker 模式

  • docker-compose yaml
version: ‘3.3‘
services:
  service1:
    image: rodolpheche/wiremock
    ports:
      - ‘9089:8080‘
    volumes:
      - ./stubs:/home/wiremock/mappings
  • stubs
users.json
{
    "request": {
      "method": "GET",
      "url": "/users"
    },
    "response": {
      "status": 200,
      "jsonBody": [
        {
          "name":"dalong",
           "appversion":"v1"
        },
        {
          "name":"login",
          "appversion":"v1"
      },
      {
          "name":"user",
          "appversion":"v1"
      }
    ],
      "headers": {
          "Content-Type": "application/json"
      }
    }
  }
  • 运行
docker-compose up -d
http://localhost:9089/users

参考资料

http://wiremock.org/docs/

以上是关于wiremock 基本docker 运行的主要内容,如果未能解决你的问题,请参考以下文章

从 JUNIT 以编程方式在远程 Unix 服务器上运行 WireMock

(07)使用WireMock快速伪造REST服务

(07)使用WireMock快速伪造REST服务

WireMock中的SOAP附件

没有参数的springboot WireMock mock

Docker删除报错:Error response from daemon: conflict: unable to delete 08b152afcfae (must be forced)(代码片段