jmeter-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From UBIK LOAD PACK Support <supp...@ubikloadpack.com>
Subject Re: JSR223 PreProcessor - Issue
Date Thu, 28 Jun 2018 19:21:37 GMT
Hello,
1/ *vars.put("my_counter", my_counter);*
Should be:
*vars.put("my_counter", Integer.toString(my_counter));*


2/ Switch to Groovy instead of Beanshell and check cache . Beanshell does
not perform well


UbikLoadPack Support Team
@ubikloadpack


On Thu, Jun 28, 2018 at 9:13 PM, JMeter User <userseljm999@gmail.com> wrote:

> 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