Webtest for binary content, how to?
Assume a web page that returns binary content: http://localhost/website/Default.aspx?FileId=value
and we have some files with known Ids and checksums (i.e. MD5). How it's 开发者_如何学Cpossible to extract whole response and calculate it's check-sum via some visual studio webtest ?
There is a property on WebTest called ResponseBodyCaptureLimit. By default only the first 1.5 MB are captured (although I noticed you said you were getting 50 MB which surprises me). Perhaps you could try cranking this number up to hold 1 GB.
http://msdn.microsoft.com/en-us/library/microsoft.visualstudio.testtools.webtesting.webtest.responsebodycapturelimit(v=VS.100).aspx
Have you tried the property this.Context.LastResponse.BodyBytes after you yield the webtestrequest?
A custom validation rule may be the way to go to calculate that the hash matches the content.
精彩评论