yeah, it was just a quick test using the sampler. I now do it in a bean shell using Pattern and Matcher with a while around Matcher.find().
Cheers, Paul. On Wed, Oct 6, 2010 at 9:30 PM, Deepak Shetty <[email protected]> wrote: > > I then (for the sake of doing it simply) have 15 RegEx PostProcessors to > extract each link from the results. > Just to confirm you know you can use a regex to extract 15 values(assuming > this is possible) directly and loop over them right? > > On Wed, Oct 6, 2010 at 4:09 AM, Paul Loy <[email protected]> wrote: > > > Hi All, > > > > I have the following in JMeter > > > > | > > |-- HTTP Request Sampler (search) > > | | > > | --- RegEx PostProcessors (x15) > > | > > |-- ForEach > > | | > > | --- HTTP Request Sampler (page) > > | | > > | |-- RegEx PostProcessor (extracts $_something) > > | | > > | --- BeanShell PostProcessor > > | > > |-- HTTP Request Sampler (using $_somelist) > > > > The first HTTP request performs a search that gets a list of 10 items. I > > then (for the sake of doing it simply) have 15 RegEx PostProcessors to > > extract each link from the results. For each of those links I then > extract > > some other information via another HTTP Request. The idea is then to > create > > a list of some of these items that I use in the final HTTP Request. My > > BeanShell PostProcessor should do this. Here is the code I have in there: > > > > String thing = (String) vars.get("_something"); > > Object list_obj = vars.get("_somelist"); > > String list = null; > > > > if (list_obj == null) { > > log.info("new list"); > > list = thing; > > } > > else { > > log.info("concat list"); > > java.util.Random random = new > > java.util.Random(System.currentTimeMillis()); > > > > int rand = random.nextInt(100); > > > > if (rand < 40) { > > list = (String) list_obj; > > list += "%2C" + thing; > > } > > } > > > > vars.put("_somelist", list); > > > > When I run this, I get the following Logging: > > > > 2010/10/06 11:46:58 INFO - jmeter.util.BeanShellTestElement: *new list* > > 2010/10/06 11:46:58 INFO - jmeter.util.BeanShellTestElement: *concat > list* > > > > 2010/10/06 11:46:58 INFO - jmeter.util.BeanShellTestElement: *new list* > > 2010/10/06 11:46:58 INFO - jmeter.util.BeanShellTestElement:* concat > list* > > > > 2010/10/06 11:46:58 INFO - jmeter.util.BeanShellTestElement: *new list* > > 2010/10/06 11:46:58 INFO - jmeter.util.BeanShellTestElement: *concat > list* > > > > 2010/10/06 11:46:58 INFO - jmeter.util.BeanShellTestElement: *new list* > > 2010/10/06 11:46:59 INFO - jmeter.util.BeanShellTestElement: *concat > list* > > > > 2010/10/06 11:46:59 INFO - jmeter.util.BeanShellTestElement: *new list* > > 2010/10/06 11:46:59 INFO - jmeter.util.BeanShellTestElement: *concat > list* > > 2010/10/06 11:46:59 INFO - jmeter.util.BeanShellTestElement: *concat > list* > > 2010/10/06 11:46:59 INFO - jmeter.util.BeanShellTestElement: *concat > list* > > > > 2010/10/06 11:46:59 INFO - jmeter.util.BeanShellTestElement: *new list* > > 2010/10/06 11:46:59 INFO - jmeter.util.BeanShellTestElement: *concat > list* > > > > 2010/10/06 11:46:59 INFO - jmeter.util.BeanShellTestElement: *new list* > > > > It does indeed loop through 15 times, but seemingly arbitrarily it thinks > > that var _somelist is null and so starts a new list. > > > > Any thoughts? > > > > Thanks in advance, > > > > Paul. > > > > -- > > --------------------------------------------- > > Paul Loy > > [email protected] > > http://uk.linkedin.com/in/paulloy > > > -- --------------------------------------------- Paul Loy [email protected] http://uk.linkedin.com/in/paulloy

