Flushing all cookies / tokens in jMeter
When launching a chain of experiments or jobs in jMeter project you might require to flush all the tokens from the previous step. To make it exactly when you need it, I suggest using simple Java script withing JSR223 processors.Use PreProcessor if you want to remove tokens at the beginning of a job,
or PostProcessor for flushing all tokens in the end of some process.
1. Add JSR223 Pre- or PostProcessor:
2. Set language to what you like (in my case - java);
3. Provide your code into Script field. E.g. let's use CookieManager in java:
import org.apache.jmeter.protocol.http.control.CookieManager; CookieManager cManager = sampler.getCookieManager(); int count = cManager.getCookieCount(); for (int index = 0; index < count; index++) { cManager.remove(0); }
Here it is. That will remove all the tokens including, for example, JSESSIONID token.
Комментариев нет:
Отправить комментарий