7
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对象的输出/响应。最好的方法是什么?

4

1 回答 1

2

添加 PostRequest 事件处理程序

request1.PostRequest += new EventHandler<PostRequestEventArgs>(request1_PostRequest);

处理方法:

void request1_PostRequest(object sender, PostRequestEventArgs e)
{
    String responseBody = e.Response.BodyString;
}
于 2013-11-08T03:32:58.603 回答