【问题标题】:How to generate mock server for pact consumer from contract json file?如何从合同 json 文件为契约消费者生成模拟服务器?
【发布时间】:2017-10-18 09:47:47
【问题描述】:

我想使用来自提供者的合同文件来针对消费者运行测试。 我有

{
"provider": {
    "name": "Provider"
},
"consumer": {
    "name": "Consumer"
},
"interactions": [
    {
        "description": "Get data",
        "request": {
            "method": "Get",
            "path": "/data/1"
        },
        "response": {
            "status": 200,
            "headers": {
                "Content-Type": "application/json"
            },
            "body": {
                "message": ""
            }
        },
        "providerState": "state"
    }
],
"metadata": {
    "pact-specification": {
        "version": "2.0.0"
    },
    "pact-jvm": {
        "version": "3.5.6"
    }
}

并想用它来生成协议模拟服务器,例如:

RequestResponsePact pact = new RequestResponsePact(mockServerDescriptionString);

可以这样做吗?

【问题讨论】:

    标签: pact pact-java


    【解决方案1】:

    没有。但您可以使用pact-stub-serverpact-stub-service CLI

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2019-11-01
      • 2015-10-20
      相关资源
      最近更新 更多