Hi list.
I have a slightly complex test I'm working on where I process a JSON
response. I loop through looking at each value of one particular field,
where the nth value is some string I know I need. Then I want to choose the
nth value of a second field to reuse in the test.
So I have two regex extractors set to match number -1, each grabbing one of
the two fields, then this in a BSH post-processor:
int i=0;
String subject;
String guid;
do {
subject = vars.get("subjects_"+Integer.toString(i));
guid = vars.get("pair_guids_"+Integer.toString(i));
i++;
} while (i<5);
//} while (! subject.contains("DESIREDSTRING"));
vars.put("subject", subject );
vars.put("guid", guid );
With the i<5 check (debugging code), it works fine, but obviously doesn't
always grab the correct element. But with the alternative while clause
using String.contains, I get the following error:
2013/09/03 09:30:17 ERROR - jmeter.util.BeanShellInterpreter: Error
invoking bsh method: eval Sourced file: inline evaluation of: `` int i=0;
String subject; String guid; do { subject = vars.get("subjects_"+Inte . . .
''
2013/09/03 09:30:17 WARN - jmeter.extractor.BeanShellPostProcessor:
Problem in BeanShell script org.apache.jorphan.util.JMeterException: Error
invoking bsh method: eval Sourced file: inline evaluation of: `` int i=0;
String subject; String guid; do { subject = vars.get("subjects_"+Inte . . .
''
I get similar errors on method calls like String.startsWith() too. Can
anyone shed any light on why?
Thanks in advance,
Richard