When playing back a recorded web test with Microsoft Visual Studio Team System 2008 Test Edition SP1 the web test fails due the size of the Response
Scenario: You have a recorded a web test using Microsoft Visual Studio Team System 2008 Test Edition SP1. When you play back the web test it fails. The actual error message might vary.
Reason: By default Microsoft Visual Studio Team System 2008 Test Edition SP1 captures the first 1.5 MB of the response; as a result the response is truncated.
Solution 1:
- Create a coded Web test by converting a recorded Web test
- Add the following code to the constructor - this.ResponseBodyCaptureLimit = 3500000;
Solution 2:
- Create a Web Test Plug-In
- Sample code for the plug-in
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Microsoft.VisualStudio.TestTools.WebTesting;
namespace PluginSample
{
public class Class1 : WebTestPlugin
{
public override void PreWebTest(object sender, PreWebTestEventArgs e)
{
e.WebTest.ResponseBodyCaptureLimit = 2000000;
}
}
}
To add the Web test plug-in, click Set Web Test Plug-in on the toolbar. This displays your test plug-in in the Set Web Test Plug-in dialog box. Select your class and then click OK.