1

I'm using a Web Performance Test Recorder to do a load test. My customer is requesting to save a PDF file being displayed on the IE. Is that possible to be done by the Web Performance Test alone ? if not is there any possible solution for this ?

LameLoura
  • 148
  • 1
  • 9

1 Answers1

2

There is no built-in way to save responses as far as I know. You would have to write a WebTestRequestPlugin to write the response to a file.

Here is a naive implementation as a starting point.

public class SaveResponsePlugin : WebTestRequestPlugin
{
    [DisplayName("File Name")]
    [Description("Name of file in which to save the response")]
    public string FileName { get; set; }

    public override void PostRequest(object sender, PostRequestEventArgs e)
    {
        if (e.ResponseExists && !e.Response.IsBodyEmpty)
            File.WriteAllBytes(this.FileName, e.Response.BodyBytes);
    }
}
agentnega
  • 3,478
  • 1
  • 25
  • 31