2017-10-17 71 views
0

我想使用提供者的契約文件來針對消費者運行測試。 我如何從契約json文件爲契約使用者生成模擬服務器?

{ 
"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); 

是否有可能做到這一點?

回答