1.解析模拟的MockService地址,生成soap project
2. 右击解析出的 wsdl 方法名,选择“New MockResponse” 模拟响应消息
每个Response 模拟返回参数,如下图所示
3.所有响应MockResponse创建完毕,设置路由派转控制。soapUI 默认支持5种格式的消息Dispatch.只需要follow 具体的语法格式 都可以实现路由控制
我采用的是script方式进行路由控制,如下图所示
log.info("================>"+mockRequest.requestContent ); def holder = new com.eviware.soapui.support.XmlHolder( mockRequest.requestContent ) def command = holder["//*:mesCommandSynch/command/text()"] ; log.info("================>"+command); if(command.contains("equipment.getEquipmentEeprom")){ return "getEquipmentEeprom" }else if(command.contains("equipment.getEquipmentOnlineStatus")){ return "getEquipmentOnlineStatus" }else if(command.contains("equipment.getEquipmentStatusAndHost")){ return "getEquipmentStatusAndHost" }else if (command.contains("equipment.getEC")){ return "getEC" }else if (command.contains("equipment.setEC")){ return "setEC" } return "DefaultResponse"
4. 所有mockResponse创建完毕并且路由控制设置完毕,右击project name,选择 "Start Minimized",这时模拟的MockService所有工作就全部结束 如下图:
著作权归作者所有。
商业转载请联系作者获得授权,非商业转载请注明出处