Reputation: 1
I am using jmeter to run load test of my script recording for mobile application. When i am running the recorded script then i am getting Response code 401 Response message Unauthorized error when running load test for mobile application
Thread Name: Thread Group 1-1 Sample Start: 2017-09-07 06:52:06 UTC Load time: 37 Connect Time: 0 Latency: 37 Size in bytes: 468 Sent bytes:969 Headers size in bytes: 293 Body size in bytes: 175 Sample Count: 1 Error Count: 1 Data type ("text"|"bin"|""): text Response code: 401 Response message: Unauthorized
Response headers: HTTP/1.1 401 Unauthorized Date: Thu, 07 Sep 2017 06:52:06 GMT Server: Apache X-Frame-Options: SAMEORIGIN Vary: Cookie X-Powered-By: PHP/7.0.21 Cache-Control: no-cache, private Content-Length: 175 Keep-Alive: timeout=5, max=95 Connection: Keep-Alive Content-Type: application/json
HTTPSampleResult fields: ContentType: application/json DataEncoding: null
Upvotes: 0
Views: 2790
Reputation: 11
Adding HTTP Authorization Manager to Thread Group having username, password and domain (if applicable) to tests works
Upvotes: 0
Reputation: 168157
As per 401 Unauthorized HTTP Status Code description:
The HTTP 401 Unauthorized client error status response code indicates that the request has not been applied because it lacks valid authentication credentials for the target resource.
your request seems to be missing credentials.
Depending on your application authentication implementation you should be able either to add HTTP Authorization Manager and configure it to match your application expectations or alternatively your test may miss (or have improperly working correlation), for instance it might be a dynamic request parameter, a HTTP Header or HTTP Cookie. In the latter case record your test once more, compare generated .jmx scripts, detect differences and work them around using JMeter's Post-Processors.
Upvotes: 0