Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

access the response from a web coded performance test

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;

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 ?

like image 801
arun Avatar asked Aug 06 '13 14:08

arun


People also ask

How do you test the performance of a Web service?

Load testing is used to determine how an application performs based on a certain volume of users. Generally, load tests will increase the volume of requests in the duration of the tests, but load tests can be used to gather performance data from any given load, small or large.


1 Answers

add PostRequest event handler

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

handler method:

void request1_PostRequest(object sender, PostRequestEventArgs e)
{
    String responseBody = e.Response.BodyString;
}
like image 67
Wagner Leonardi Avatar answered Sep 20 '22 00:09

Wagner Leonardi