Deepak - thanks for the simple and valid idea, please allow me to explain what I need and done from scratch.
My load test script looks like: +Test Plan ++Authenticated View Blogs (thread group) +++Once only controller ++++Login (Include controller) +++View Blog (Include controller) +++Throughput controller (re-login only sometimes) ++++Login (Include controller) ++Anonymous View Blogs (thread group) +++View Blog (Include controller) +++Throughput controller (drop session only sometimes) ++++Drop anonymous session (and all cookies) <--- not yet implemented . . . (total of ~40 thread groups) Login.jmx (which is used above) looks like: +Login (http sampler) ++pre processor to drop all cookie Now, I need to sometimes drop sessions for anonymous threads as well. With the idea from Deepak I've added post processor, which save the cookieManager into a vars, and placed this post processor in the root of my main Test Plan above. Utilizing the fact that post processors are applied to samplers fetched using the Include Controller, I now have the cookieManager available for any thread at any time in the vars. I'm giving that a first try now with real load test, but I don't expect having multiple references to the CookieManager break anything... Thanks for the help. Shmuel Krakower. www.Beatsoo.org - re-use your jmeter scripts for application performance monitoring from worldwide locations for free. On Wed, Apr 30, 2014 at 12:12 AM, Shmuel Krakower <[email protected]>wrote: > Sounds like a good idea for my need. > I'll update tomorrow. > > Thanks both! > > www.beatsoo.org - free application performance monitoring from world wide > locations. > On Apr 29, 2014 11:26 PM, "Deepak Shetty" <[email protected]> wrote: > >> I would try >> In your first http sampler have a pre processor that sets the >> CookieManager >> into variables >> vars.putObject("cookiemanager" ,sampler.getCookieManager()); >> >> Then its available for use in any sampler in that thread - Im not certain >> if this has any side effects and as before I agree with what sebb said. >> >> regards >> deepak >> >> >> On Tue, Apr 29, 2014 at 11:14 AM, Shmuel Krakower <[email protected] >> >wrote: >> >> > I'll try to explain better tomorrow my use case, but can you think of a >> way >> > to clear cookies in another way? >> > >> > www.beatsoo.org - free application performance monitoring from world >> wide >> > locations. >> > On Apr 29, 2014 8:37 PM, "Deepak Shetty" <[email protected]> wrote: >> > >> > > >but I don't want to send an http request to my application in order >> to >> > run >> > > this preprocessor, as in real life such requests do not take place. >> > > The point sebb is making is that the only time clearing cookies is >> > relevant >> > > is on the next sampler that makes an HTTP request so you dont need to >> > make >> > > any additional http requests. >> > > so you'd basically have to flag the fact that you need a cookie >> > > reset(wherever you are making that determination) and you check that >> flag >> > > in a pre processor and clear cookies when that happens and then reset >> the >> > > flag. >> > > >> > > >> > > On Tue, Apr 29, 2014 at 10:31 AM, Shmuel Krakower <[email protected] >> > > >wrote: >> > > >> > > > Basically I have a structured script where all of the actual >> samplers >> > are >> > > > used by an include controller. >> > > > >> > > > I need to "sometimes" re-login the thread and for that I use a >> > throughput >> > > > controller which include the login module, which clear all cookies >> like >> > > > I've described with a pre processor and execute a new login request. >> > > > >> > > > I also need to achieve the same cookies drop for anonymous users >> > > > "sometimes", but I don't want to send an http request to my >> application >> > > in >> > > > order to run this preprocessor, as in real life such requests do not >> > take >> > > > place. >> > > > >> > > > I hope it make sense. >> > > > >> > > > www.beatsoo.org - free application performance monitoring from >> world >> > > wide >> > > > locations. >> > > > On Apr 29, 2014 6:45 PM, "sebb" <[email protected]> wrote: >> > > > >> > > > > On 28 April 2014 14:40, Shmuel Krakower <[email protected]> >> wrote: >> > > > > > Hi, >> > > > > > I need to clear all cookies on certain cases. >> > > > > > For that I use a BSF pre processor with the following code: >> > > > > > >> > > > > > while(sampler.getCookieManager().getCookieCount() > 0) >> > > > > > { >> > > > > > sampler.getCookieManager().remove(0); >> > > > > > } >> > > > > > >> > > > > > This works just fine. >> > > > > > >> > > > > > The thing is that I want to be able to execute this code in >> other >> > > > places >> > > > > / >> > > > > > cases where I don't trigger an HTTP Request (the >> > > > > sampler.getCookieManager() >> > > > > > will only work if the BSF is located as a child of an HTTP >> > request). >> > > > > > >> > > > > > Anyone can suggest how can I clear all cookies in another way? >> > > > > >> > > > > Surely the cookies are only relevant to the HTTP Sampler, so >> clearing >> > > > > them before the sample should be sufficient? >> > > > > >> > > > > Why is there a need to clear the cookies any where else? >> > > > > >> > > > > > Best, >> > > > > > >> > > > > > Shmuel Krakower. >> > > > > > www.Beatsoo.org - re-use your jmeter scripts for application >> > > > performance >> > > > > > monitoring from worldwide locations for free. >> > > > > >> > > > > >> --------------------------------------------------------------------- >> > > > > To unsubscribe, e-mail: [email protected] >> > > > > For additional commands, e-mail: [email protected] >> > > > > >> > > > > >> > > > >> > > >> > >> >
