2
votes

I have to perform load testing of a particular application and am using JMeter for that.

In my application, I have a unique access token which will be obtained on successful login and this token has to be passed to the consecutive requests to obtain the response.

Now I have added a recorder for my test plan and ran the HTTP test script recorder.all the browser action is recorded in the recorder of the test plan. the structure of my test plan and workbench is as mentioned below.

**Testplan-**  
     *Threadgroup*  
         Recorder-  
//inside the recorder   
            [Request1-login  
            Request2-To load the uploaded images by the corresponding user]  
//Outside the recorder inside the thread group,  
         View Results Tree  
HTTP Cache Manager  
HTTP Coockie Manager  
**WorkBench**  
HTTP(s) Test Script Recorder

By default, there is a header manager for each request when recorded what I did was to add the extracted token obtained using json extracter of the request1 to the header manager of the request2 in the recorded script.

The token is getting passed along with the request header as shown below but the response obtained is unauthorised.

Request Headers:

Connection: keep-alive  
Referer: http://localhost/  
Accept-Language: en-US,en;q=0.5  
Origin: http://localhost  
Content-Type: application/json;charset=utf-8
Accept-Encoding: gzip, deflate
User-Agent: Mozilla/5.0 (Windows NT 6.3; WOW64; rv:56.0) Gecko/20100101 Firefox/56.0
Accept: application/json, text/plain, */*
Authorisation:91kLM68tdMBoDFRURArvdmwYgWV9Nr2sHYDwivTM.91kLM68tdMBoDFRURArvdmwYgWV9Nr2sHYDwivTM.Arvdm_M68-BoDFRURArvdmwYgWV9Nr2sHYDwivTM  
Content-Length: 0  
Host: http://localhost/phpmyadmin/index.php  

I have checked the same token in postman and am obtaining the correct response.

am I missing out something?Is there anything else I have to take care of before running the recorded test script?Please help

1

1 Answers

1
votes

Compare exactly (Header + Body) requests :

  • sent by postman
  • vs request sent by JMeter

There must be a difference somewhere.

And in CookieManager ensure you have set Policy to "standard" if using JMeter 3.x

As per your comment:

  • Authorization was misspelled (Authorisation)