Increase Web Test Reponses Size

10/02/2011

Increase Web Test Reponses Size

I just visit a customer that has a problem doing Web Test on his Web Application, the problem were that the response was cut off before web test was able to receive all the data, when he looked at the response he saw the data from the server but no all the data came back.
The response is almost 5mb and for some reason Web Test is unable to save all the data… Why?

The reason is VS has a receive buffer that defaults to 1,500,000 bytes (1.5 megabytes) and it throws away anything over that.
The number reported is what is saved in the buffer, not the number of bytes received.

In order to solve this issue you can just create a WebTestPlugin that will override  ResponseBodyCaptureLimit size limit. The code for that Plugin is super simple =

public class ResponseBodyCaptureLimitPlugin : WebTestPlugin
{
    public int ResponseSizeLimit { get; set; }
    public override void PreWebTest(object sender, PreWebTestEventArgs e)
    {
        e.WebTest.ResponseBodyCaptureLimit = this.ResponseSizeLimit;
    }
}

The only thing you need to change is before the Web Test starts is the ResponseBodyCaptureLimit value.

image

And Another tip if you want to use those Web Test scripts in Load Test you should define “Record Details” to False

Record Details – True indicates that performance counts data is collected for this HTTP request when the Web Test is added to the test mix of a load test. False indicates that data is not collected.

image

Enjoy

Add comment
facebook linkedin twitter email

Leave a Reply