[prev in list] [next in list] [prev in thread] [next in thread] 

List:       jmeter-user
Subject:    Re: How to use Jmeter built in function within Preprocessor
From:       Felix Schumacher <felix.schumacher () internetallee ! de>
Date:       2018-06-28 20:08:20
Message-ID: 883de7ac-08f2-cd99-0d44-20deb58cddb4 () internetallee ! de
[Download RAW message or body]



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

[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic