jmeter-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Felix Schumacher <felix.schumac...@internetallee.de>
Subject Re: How to use Jmeter built in function within Preprocessor
Date Thu, 28 Jun 2018 20:08:20 GMT


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


Mime
View raw message