0
votes

I am very new to Jmeter and just started to work on it. I have a scenari, below are the input details.

Scenario:

  1. Login to the application using microsoft credentials (API No.1)
  2. Navigate to Customer search page
  3. Select the value say Search 'By name' (By name is an API No.2)
  4. Click search
  5. Results will be displayed

Step 1 API I was able to do it successfully, since I followed some videos in the internet. But for the application related API (By name), I am able to do it for the current session but not for all the session.

By name API I am passing in the 'Body Data' of 'HTTP Request' as

{"branch":null,"agent":{"code":"00092","type":null,"name":"SOVQOSTOVJT OSJOTWW","unit":{"code":"A0102","name":"OJTVWXSKSVVKJ JVSXVJXS","unitHead":null},"branch":{"code":"A0100","name":"SXTJV","channel":null},"rank":{"code":"BM","description":"Senior Director"},"emailAddress":"[email protected]","status":{"code":"01","description":"Active"},"candidate":{"number":"14000350","name":"SOVQOSTOVJT OSJOTWW","dob":"1956-04-25"},"originalAgentCode":"000092"},"searchBy":"P","nameSearchParam":{"customerName":null,"idNo":null},"policySearchParam":{"policyNo":"14708787"},"policyStatusSearchParam":{"policyStatus":null,"startDate":null,"endDate":null,"daysLeftBeforeExpiry":null},"policyByServiceTrackingSearchParam":{"customerName":null,"policyNo":null,"idNo":null,"customerStatus":null,"recievedDateBST":{"begin":"2021-06-26T","end":"2021-08-26T"}},"policyByPremiumSearchParam":{},"policyByUnsuccess":{},"unit":null}

HTTP Header Manager

enter image description here

JSON Extractor

enter image description here

The problem is, if you see the 2 token values 'manutouch_token' and 'X-Auth-Token' these are dynamic values. When i am in current session this will have these values, after logout new values will be generated. I want to store these token values somewhere and pass it or some part of the token need to be extracted. I don't know how to do this process. I have no idea at all. Can someone help me out.

enter image description here

1

1 Answers

0
votes

Most probably these tokens are returned somewhere in the login process, you need to carefully inspect all the responses (pay attention to literally everything: response body, response headers, response URL especially in case of redirection) - the tokens should be there.

Once you figure out where do they live you should be able to extract them using suitable Post-Processors, well configured Post-Processor will extract the token from the response and store it into a JMeter Variable and you will be able to replace recorded values with the dynamic variables containing actual tokens.

See Using Regular Expressions to Extract Tokens and Session IDs to Variables article for example implementation (use it as a reference only, not as the guide as your application details might be different), the key point is implementing the correlation for each and every dynamic parameter in your test scenario