jmeter-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From JMeter User <userseljm...@gmail.com>
Subject JSR223 PreProcessor - Issue
Date Thu, 28 Jun 2018 19:13:43 GMT
Added JSR223 PreProcessor with Script Language = Beanshell (Beanshell
2.0lb5)


Code is below
**********************************************************************

String MESSAGE = vars.get("MESSAGE");
log.info("OLD ----- " + MESSAGE);

int my_counter = Integer.parseInt(vars.get("my_counter"));
log.info("Initial Counter ----- " + my_counter);
my_counter = my_counter + 1;
log.info("Incremented Counter ----- " + my_counter);

//vars.put("my_counter", String.valueOf(my_counter));
*vars.put("my_counter", my_counter);*
//vars.put("my_counter", ${my_counter});

String NEWMESSAGE ="";
NEWMESSAGE = MESSAGE.replace("MYBILLERACCOUNT", my_counter);
// NEWMESSAGE = MESSAGE.replace("MYBILLERACCOUNT", ${my_counter});
log.info("NEW ----" + NEWMESSAGE);


**********************************************************************
I tried few options of all the commented code above
***********************************************************************
Getting below error line highlighted in bold

2018-06-28 14:07:37,683 ERROR o.a.j.m.JSR223PreProcessor: Problem in JSR223
script, JSR223 PreProcessor - {"account": {"accountType":
"INDIV","billerAccountId": "MYBILLERACCOUNT: []}
javax.script.ScriptException: Sourced file: inline evaluation of: ``String
MESSAGE = vars.get("MESSAGE"); log.info("OLD ----- " + MESSAGE);  int my_ .
. . '' : Error in method invocation: Method put( java.lang.String, int )
not found in class'org.apache.jmeter.threads.JMeterVariables' : at Line: 10
: in file: inline evaluation of: ``String MESSAGE = vars.get("MESSAGE");
log.info("OLD ----- " + MESSAGE);  int my_ . . . '' : vars .put (
"my_counter" , my_counter )
 in inline evaluation of: ``String MESSAGE = vars.get("MESSAGE"); log.info("OLD
----- " + MESSAGE);  int my_ . . . '' at line number 10

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message