Why do we get truncated response in VSTS webtest ?
VSTS webtest truncated response body
Are my extraction rules failing due to truncated response body in the webtest ?
How to increase response body capture limit in a webtest ?
The limit that is used for capturing response data for each of the requests in a VSTS webtest is 1,500,000 bytes. So if you have any request in your webtest for which the response body size is above 1.5 MB, the response is going to get truncated to the default size.
Most often you can find, the extraction/validation rules failing because of this truncated response, as the script is unable to extract any text which lies beyond the default limit, thus failing the extraction/validation. In order to pass such extraction/validation rules in our webtests, we will need to increase the capture size limit of the response body.
You may also find errors like “Request Failed: Unexpected end of file has occured” because of the limited capturing size of the response body.
Now, increasing the response body capture limit can be achieved in two ways. Either by developing a Coded UI webtest, or by the help of plugins in a non-Coded webtest.
Below is a simple plugin from MSDN blogs to increase the default response body capture limit in a VSTS webtest.
public class Class1 : WebTestPlugin
public override void PreWebTest(object sender, PreWebTestEventArgs e)
e.WebTest.ResponseBodyCaptureLimit = 2000000;
Comments are closed.