You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@jmeter.apache.org by JMeter User <us...@gmail.com> on 2018/06/28 19:56:54 UTC

How to use Jmeter built in function within Preprocessor

 When i try to use this function in JSR Preprocessor
${__FileToString(C:\Users\xyz\Desktop\Test.txt,,MESSAGE)}

getting below error
2018-06-28 14:38:19,325 ERROR o.a.j.m.JSR223PreProcessor: Problem in JSR223
script, JSR223 PreProcessor -
in inline evaluation of: ``{"account": {"accountType": "INDIV"," . . . '' at

line number 1



But in if we see MESSAGE in post debug processor i see value is being
assigned to MESSAGE variable as expected.

Re: How to use Jmeter built in function within Preprocessor

Posted by Felix Schumacher <fe...@internetallee.de>.

Am 28.06.2018 um 21:56 schrieb JMeter User:
>   When i try to use this function in JSR Preprocessor
> ${__FileToString(C:\Users\xyz\Desktop\Test.txt,,MESSAGE)}
>
> getting below error
> 2018-06-28 14:38:19,325 ERROR o.a.j.m.JSR223PreProcessor: Problem in JSR223
> script, JSR223 PreProcessor -
> in inline evaluation of: ``{"account": {"accountType": "INDIV"," . . . '' at
>
> line number 1

The ${...} will be replaced by JMeter before the JSR Preprocessor gets 
the text (code).
Therefore it will get the content of the file, which seems to be a JSON 
text, that will not be valid code for most of the JSR223 languages.

>
>
>
> But in if we see MESSAGE in post debug processor i see value is being
> assigned to MESSAGE variable as expected.

That is expected, as the ${...} got evaluated correctly and thus the 
variable set.

It is probably easier to remove the JSR223 Preprocessor and place the 
${...} directly where you use the variable MESSAGE the first time. If 
you use it again later in the test plan, you can reuse the variable 
instead of re-reading it from the file.

Regards,
  Felix

>


---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@jmeter.apache.org
For additional commands, e-mail: user-help@jmeter.apache.org