1

I'm using Visual Studio Team Foundation Server 2008 Team Suite to create a webtest for a site. On some pages the response is a file download (usually a PDF), and I just need to test that the response comes back with the right status code and content type, ignoring the body. When I run the webtest in Visual Studio, or run the compiled test with MSTest and load the results, those requests fail, causing the entire webtest to fail.

The Web Browser tab of the test results has the text:

Request failed: Unable to read data from the transport connection: The connection was closed.

And the Details tab contains the exception:

System.IO.IOException: Unable to read data from the transport connection: The connection was closed.
   at System.Net.ConnectStream.EndRead(IAsyncResult asyncResult)
   at Microsoft.VisualStudio.TestTools.WebStress.DataCaptureStream.EndRead(IAsyncResult asyncResult)
   at Microsoft.VisualStudio.TestTools.WebStress.WebTestTransaction.ReadResponse(IAsyncResult result)

The Response tab shows a successful response, with headers including "HTTP/1.1 200 OK" and "Content-Type : application/pdf", and the PDF content in the body.

How can I make the webtest accept PDFs or other types of files for those requests?

tspauld
  • 3,512
  • 2
  • 25
  • 22
  • How large are the .pdf file responses? – agentnega Oct 18 '11 at 22:20
  • I'm hoping that by commenting here, this question will get some more exposure. I'm having the almost exactly the same issue as tspauld except the response content is application/zip rather than pdf. I have tried increasing the timeout for the WebTestRequest and also adding a PreRequest event which increases the size of the ResponseBodyCaptureLimit. None of these have has changed the problem, with the response failing at around 4 seconds after the request was made. – Dan Sep 20 '12 at 15:15

2 Answers2

3

There is a bug in Visual Studio Team System 2008 SP1 which shows such symptoms. Try install hot fix for it. More details here: http://kbalertz.com/972678/successfully-recorded-Visual-Studio-System-authentication-redirected-logon.aspx

jan salawa
  • 1,198
  • 1
  • 8
  • 25
  • 1
    This was exactly the issue, The Microsoft link to the hotfix is http://support.microsoft.com/kb/972678, which I almost discounted without trying because it talked about an authentication problem. I hadn't thought things through as the download part of the delegates to SSRS which would maintain authentication via cookies as the bug suggests. Patch was applied this morning and the web test now runs perfectly. Thanks! – Dan Sep 25 '12 at 07:52
0

sounds like a browser issue to be honest, use the type/unknown to force a save as on the client instead of the client's default browser attempting to display it.

Tom Anderson
  • 10,807
  • 3
  • 46
  • 63
  • Realise that this answer is way out of date, but this wouldn't be a browser issue. Web Tests are run within Visual Studio or a Load Test agent, there is no browser involved. – Dan Sep 20 '12 at 15:21