public class DslVariables extends BaseConfigElement
When you only need to reuse some string or value, prefer using java variables instead of creating jmeter variables, which is easier to maintain, and makes the test plan more efficient (fewer variables in memory).
This internally uses JMeter User Defined Variables element when variables are included at test plan level, but uses JSR223 sampler otherwise to provide more consistency and avoid confusion generated by User Defined Variables semantics (like non reinitialization in threads iterations, vars cross-references, vars scope, etc. Check red blocks comments in JMeter component documentation).
| Modifier and Type | Class and Description |
|---|---|
static class |
DslVariables.CallContextEntry |
static class |
DslVariables.CodeBuilder |
| Modifier and Type | Field and Description |
|---|---|
protected Map<String,String> |
vars |
guiClass, name| Constructor and Description |
|---|
DslVariables() |
| Modifier and Type | Method and Description |
|---|---|
protected org.apache.jmeter.testelement.TestElement |
buildTestElement() |
org.apache.jorphan.collections.HashTree |
buildTreeUnder(org.apache.jorphan.collections.HashTree parent,
BuildTreeContext context)
Builds the JMeter HashTree for this TestElement under the provided tree node.
|
DslVariables |
set(String varName,
String varValue)
Allows setting a JMeter thread variable.
|
buildConfiguredTestElement, buildTestElementGui, configureTestElement, durationToSeconds, loadBeanProperties, showAndWaitFrameWith, showFrameWith, showInGui, showTestElementGuiclone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitshowInGuipublic DslVariables set(String varName, String varValue)
When the variable is set at test plan level, one variable for each thread group is created at test plan start with given name and value. When inside a thread group, controller, etc, it will only be created/updated with given value when such point in test plan is reached.
varName - specifies the name of the variable to register. This can be a literal value
(eg: "test") or a JMeter expression (eg: ${VAR_NAME}).varValue - specifies the value associated to the variable. This can be a literal value
(eg: "test") or a JMeter expression (eg: ${VAR_VALUE}).public org.apache.jorphan.collections.HashTree buildTreeUnder(org.apache.jorphan.collections.HashTree parent,
BuildTreeContext context)
DslTestElementbuildTreeUnder in interface DslTestElementbuildTreeUnder in class BaseTestElementparent - the node which will be the parent for the created tree.context - context information which contains information shared by elements while building
the test plan tree (eg: adding additional items to test plan when a particular protocol element
is added).protected org.apache.jmeter.testelement.TestElement buildTestElement()
buildTestElement in class BaseTestElementCopyright © 2023. All rights reserved.