/// <summary> /// /// </summary> /// <param name="tc"></param> private void RunTestCase(ICallInvoker <AmpMessage> caller, TestCase tc, IMessageParser <AmpMessage> parser) { try { Console.WriteLine("--------start run testcase {0}-----------", tc.Id); Console.WriteLine("ServiceId: {0},MessageId:{1},Req:{2}", tc.ServiceId, tc.MessageId, tc.Json); RequestData rd = new RequestData(); rd.ServiceId = tc.ServiceId; rd.MessageId = tc.MessageId; rd.Data = new Dictionary <string, string>(); rd.RawBody = tc.Json; AmpMessage req = parser.ToMessage(rd); if (req == null) { TOTAL_ERROR++; Console.WriteLine("协议转换出错,请检查serviceId={0}和messageId={1}", tc.ServiceId, tc.MessageId); System.Environment.Exit(1); return; } AmpMessage rsp = caller.BlockingCall(req); if (rsp == null) { TOTAL_ERROR++; Console.WriteLine(">>----end run testcase {0} fail,no repsonse--------", tc.Id); } else { Console.WriteLine(">>----end run testcase {0} success,response code = {1}-------", tc.Id, rsp.Code); var jsonRsp = parser.ToJson(rsp); if (string.IsNullOrEmpty(jsonRsp)) { TOTAL_ERROR++; Console.WriteLine(">>----end run testcase {0} fail,没有配置对应服务响应消息---------", tc.Id); } else { Console.WriteLine(">>response:{0}", jsonRsp); } } } catch (Exception ex) { Console.WriteLine("执行测试出错:" + ex.Message); System.Environment.Exit(1); } }