views:

152

answers:

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?

A: 

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