user1254382
user1254382

Reputation: 33

Playback errors with Visual Studio Web Performance Testing

Using Visual Studio 2015 I have been trying to create some automated tests using Visual Studio 2015. I used Fiddler to watch the request/response packages. The web application is running on IIS8.5.

I create a new web request and record logging into our web site - which works correctly. I then play back the recorded test and logging in fails with various 400,401 and 405 errors. I will detail the first failed http requests :

When recording the initial logging in, Fiddler posts the request:

OPTIONS http://api.XXX.co/token HTTP/1.1
Accept: */*
Origin: http://qq.XXX.co
Access-Control-Request-Method: POST
Access-Control-Request-Headers: accept, content-type
Accept-Encoding: gzip, deflate
User-Agent: Mozilla/5.0 (compatible; MSIE 10.0; Windows NT 6.2; WOW64; Trident/6.0)
Host: api.XXX.co
Content-Length: 0
DNT: 1
Connection: Keep-Alive
Pragma: no-cache

with response

HTTP/1.1 200 OK
Cache-Control: no-cache
Pragma: no-cache
Expires: -1
Server: Microsoft-IIS/8.5
Access-Control-Allow-Origin: http://qq.XXX.co
Access-Control-Allow-Credentials: true
Access-Control-Allow-Headers: accept,content-type
X-AspNet-Version: 4.0.30319
X-Powered-By: ASP.NET
Date: Mon, 06 Jun 2016 16:10:47 GMT
Content-Length: 0

but when played back through Visual Studio the same request is :

OPTIONS http://api.XXX.co/token HTTP/1.1
User-Agent: Mozilla/5.0 (compatible; MSIE 10.0; Windows NT 6.1; Trident/6.0)
Accept: */*
Accept-Language: en-GB
Accept-Encoding: GZIP
Host: api.XXX.co
Content-Length: 0

and the response is :

HTTP/1.1 400 Bad Request
Cache-Control: no-cache
Pragma: no-cache
Content-Length: 34
Content-Type: application/json; charset=UTF-8
Expires: -1
Server: Microsoft-IIS/8.5
Server: Microsoft-IIS/8.5
X-AspNet-Version: 4.0.30319
X-Powered-By: ASP.NET
Date: Mon, 06 Jun 2016 16:12:20 GMT

{"error":"unsupported_grant_type"}

Here we have error "unsupported_grant_type" - and I have no idea why this might be occurring!!

Can anyone give me a clue as to what is happening here?

Upvotes: 0

Views: 718

Answers (1)

AdrianHHH
AdrianHHH

Reputation: 14066

Visual Studio adds a set of headers to the request. Comparing the headers recorded by Fiddler against those from Visual Studio in you question shows several differences. The impact of those differences is dependant on how the website behaves. You may find that explicitly adding some of the missing headers will solve the problem. Additional header fields can be added via the context (right click) menu on the request. Header fields can be removed or rewritten in plugins.

Upvotes: 1

Related Questions