标签:ken received header apu border chm rate uri rda
Script-Assertion允许对消息进行任意验证,包括消息内容,HTTP头等。Script-Assertion使用脚本语言(Groovy或JavaScript)编写。使用标准的“Add Assertion”按钮将Script-Assertion添加到TestStep中;
1. 在响应中验证HTTP头的内容
// check for the amazon id header assert messageExchange.responseHeaders["Server"] != null
2. 验证一定的响应时间
// check that response time is less than 400 ms assert messageExchange.timeTaken < 400
3. 验证响应中是否存在附件
// check that we received 2 attachments assert messageExchange.responseAttachments.length == 2
4. 验证响应中是否存在特定的XML元素
// check for RequestId element in response def holder = new XmlHolder( messageExchange.responseContentAsXml ) assert holder["//ns1:RequestId"] != null
标签:ken received header apu border chm rate uri rda
原文地址:http://www.cnblogs.com/zerotest/p/6910591.html