1

Context

I am developing a custom JMeter plugin which generates test data dynamically from a tree like structure.

The editor for the tree generates GUI input fields as needed, and therefore I have no set of defined configuration properties which are set in the respective TestElement. Instead, I serialize the tree as a whole in the GUI class, set the result as one property and deserialize it in the config element where it is processed further during test execution.

Problem

This works just fine, except that JMeter variable/function expressions like ${foo} or ${_bar(..)} in the dynamic input fields are not evaluated. As far as I understand the JMeter source code, the evaluation is triggered somehow if the respective property setters in org.apache.jmeter.testelement.TestElement are used which is not possible for my plugin.

Unfortunately, I was not able to find a proper implementation which can be used in my config element to evaluate such expressions explicitly after deserialization.

Question

I need a pointer to JMeter source code or documentation for evaluating variable/function expressions explicitly.

1 Answer 1

1

After I manages to setup the JMeter-Project properly in my IDE, I found org.apache.jmeter.engine.util.CompoundVariable which can be used like this:

CompoundVariable compoundVariable = new CompoundVariable(); compoundVariable.setParameters("${foo}"); // returns the value of the expression in the current context compoundVariable.execute(); 
Sign up to request clarification or add additional context in comments.

1 Comment

i got super lucky you decided to document this here. would have taken me a while

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.