On 05/09/07, Ronan Klyne <[EMAIL PROTECTED]> wrote: > sebb wrote: > > Not easily. > > > > You could try using the If Controller > > > > > > http://jakarta.apache.org/jmeter/usermanual/component_reference.html#If_Controller > > with the condition > > > > ${JMeterThread.last_sample_ok}" == "true" (check if last sample succeeded) > > > > e.g. > > > > A1 > > If OK > > + A2 > > If OK > > + A3 > > If not OK > > + handle error > > > > but this quickly becomes a bit tedious to code if there are lots of > > samplers. > > True... > > > If you can use a single sampler with variables read from a file, then > > you might be able to use a looping controller (or While Controller) > > instead. This would be harder to set up, but easier to extend once it > > was working. This only works if the samplers all need the same number > > of parameters, though you could get clever and use a Switch Controller > > to select between samplers with different numbers of parameters... > > This is looking like way forward. It has given me an unexpeceted concern > though: > In one place in my code I have a single sampler with this code in a > BeanShell pre-processor to vary the parameter names and numbers: > > while (en.hasMoreElements()) { > user = en.nextElement(); > reason = chosen.get(user); > sampler.addArgument("response_type", reason); > sampler.addArgument("issued_users", user); > sampler.addArgument("resptype_" + user, reason); > sampler.addArgument("comment_" + user, ""); > sampler.addArgument("group_id_" + user, "0"); > sampler.addArgument("due_date_" + user, ""); > } > > Am I to infer from your comment that this is unwise?
No, that should be fine. I just meant that it is not possible to have optional parameters on the HTTP sampler dialogue - even if the name and value both resolve to blanks, the sampler will still generate a parameter. [I think there was once an idea to skip the parameter creation if the name and value were both blank, but this was not implemented...] By the way, BeanShell tends to leak more memory if the script is on the screen; using a file seems better. Best is probably to define the script as a method in a startup file and then invoke from a file or the screen. > # r > > -- > Ronan Klyne > Business Collaborator Developer > Tel: +44 (0)870 163 2555 > [EMAIL PROTECTED] > www.groupbc.com > > --------------------------------------------------------------------- > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > > --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]

