'Creating JMeter tests using BlazeMeter plugin, same day creation works perfectly in JMeter, the next day auth succeeds but other calls fail w/401
I'm using BlazeMeter plugin to create JMeter scripts. I've been able to create multiple scenarios and merge them into one JMeter test. All of the scenarios have an initial Auth with then a series of GET's and PUT's. The JMeter tests import successfully and I'm able to run them and get results but when I try on day two (the next day) to run them, the auth works fine but then I get a series of 401 unauthorized on the GET's and PUT's so I'm trying to figure out what setting is causing it to run the same day I create but not the day after. I've messed with the cookie, cache and auth manager settings to no avail (i.e. tried clearing/non clearing), but it doesn't work. Trying to understand why it would work on the day I created it but not the next. Any help would be appreciated.
Solution 1:[1]
Most probably your application uses some form of security token like Bearer Token which has some limited life time, i.e. one hour or one day so when you record your test scenario you're able to replay it successfully for limited amount of time.
But when the token expires you're not able to replay it successfully because you're not authorized anymore.
The solution would be performing the correlation: the process of extracting a dynamic value using a suitable JMeter Post-Processor and save it into a JMeter Variable. Once done replace the recorded hard-coded value with the dynamic variable from the Post-Processor. This time when the virtual user logs in he will get a "fresh" token so you will be able to replay your test successfully.
You can try out BlazeMeter Proxy Recorder, it's capable of exporting recorded scripts in "SmartJMX" mode with automatic detection and correlation of dynamic parameters. See How to Cut Your JMeter Scripting Time by 80% article for more details.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | Dmitri T |
