本文介绍了访问来自Web编码性能测试的响应的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
WebTestRequest request1 = new WebTestRequest((this.Context["Environment"].ToString() + "/IBWeb/DefaultSB.aspx"));
request1.Headers.Add(new WebTestRequestHeader("Referer", (this.Context["Environment"].ToString() + "/IBWeb/")));
ExtractHiddenFields extractionRule1 = new ExtractHiddenFields();
extractionRule1.Required = true;
extractionRule1.HtmlDecode = true;
extractionRule1.ContextParameterName = "1";
request1.ExtractValues += new EventHandler<ExtractionEventArgs>(extractionRule1.Extract);
yield return request1;
request1 = null;
我有一个如上所述的编码的Web性能测试.该测试运行没有任何问题..但是我想从WebTestRequest
对象访问输出/响应.最好的方法是什么?
I have a coded web performance test as mentioned above.. The test runs without any issues..But I would like to access the output/response from the WebTestRequest
object. what is the best approach to do it ?
推荐答案
添加PostRequest事件处理程序
add PostRequest event handler
request1.PostRequest += new EventHandler<PostRequestEventArgs>(request1_PostRequest);
处理程序方法:
void request1_PostRequest(object sender, PostRequestEventArgs e)
{
String responseBody = e.Response.BodyString;
}
这篇关于访问来自Web编码性能测试的响应的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!