kiran
kiran

Reputation: 1

Error invoking bsh method: eval.....Sourced file: inline evaluation of:

i need to pass variable(Extracted from response) from one thread to another Response:"16540$Add373" i need digits before $ RegEx: Ref Name:SFID regex:"[$] Template:$1$ MatchNo:1

I've used beanshell assertion to set variable in to jmeter property

${_setProperty(SFID1,${SFID})};

While executing i'm getting

Assertion failure message: org.apache.jorphan.util.JMeterException: Error invoking bsh method: eval Sourced file: inline evaluation of: ``${_setProperty(SFID1,${SFID})};'' : Attempt to access property on undefined variable or class name

Upvotes: 0

Views: 10730

Answers (2)

user3686885
user3686885

Reputation: 1

The answer is - ${__property(SFID1)}. Double '_' after {start.

Upvotes: 0

Dmitri T
Dmitri T

Reputation: 168207

  1. Your function is missing underscore
  2. Your function is missing comma

Correct syntax is:

${__setProperty(SFID1,${SFID},)}

I recommend using Function Helper Dialog to generate functions as you can easily get confused with all these round and curly brackets.

Another approach is using vars and props pre-defined Beanshell variables like:

props.put("SFID1", vars.get("SFID"));

where:

See How to Use BeanShell: JMeter's Favorite Built-in Component guide for extended information on Beanshell scripting in JMeter

Upvotes: 1

Related Questions