Package us.abstracta.jmeter.javadsl.java
Class DslJsr223Sampler
- java.lang.Object
-
- us.abstracta.jmeter.javadsl.core.testelements.BaseTestElement
-
- us.abstracta.jmeter.javadsl.core.testelements.DslJsr223TestElement<DslJsr223Sampler,DslJsr223Sampler.SamplerVars>
-
- us.abstracta.jmeter.javadsl.java.DslJsr223Sampler
-
- All Implemented Interfaces:
DslTestElement,DslSampler,BaseThreadGroup.ThreadGroupChild
public class DslJsr223Sampler extends DslJsr223TestElement<DslJsr223Sampler,DslJsr223Sampler.SamplerVars> implements DslSampler
Allows sampling java APIs and custom logic.This is a very powerful component, but using it makes code harder to maintain. When there is another sampler available that satisfy your needs use it instead of this one.
By default, provided script will be interpreted as groovy script, which is the default setting for JMeter. If you need, you can use any of JMeter provided scripting languages (beanshell, javascript, jexl, etc.) by setting the
DslJsr223TestElement.language(String)property.- Since:
- 0.22
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classDslJsr223Sampler.CodeBuilderstatic classDslJsr223Sampler.DslLambdaSamplerstatic interfaceDslJsr223Sampler.SamplerScriptAllows to use any java code as script.static classDslJsr223Sampler.SamplerVars-
Nested classes/interfaces inherited from class us.abstracta.jmeter.javadsl.core.testelements.DslJsr223TestElement
DslJsr223TestElement.Jsr223DslLambdaTestElement<V extends DslJsr223TestElement.Jsr223ScriptVars>, DslJsr223TestElement.Jsr223Script<V extends DslJsr223TestElement.Jsr223ScriptVars>, DslJsr223TestElement.Jsr223ScriptVars, DslJsr223TestElement.Jsr223TestElementCallBuilder<T extends org.apache.jmeter.testelement.TestElement>
-
-
Field Summary
Fields Modifier and Type Field Description protected List<BaseSampler.SamplerChild>children-
Fields inherited from class us.abstracta.jmeter.javadsl.core.testelements.DslJsr223TestElement
DEFAULT_LANGUAGE, language, script, scriptClass, scriptString
-
Fields inherited from class us.abstracta.jmeter.javadsl.core.testelements.BaseTestElement
guiClass, name
-
-
Constructor Summary
Constructors Constructor Description DslJsr223Sampler(String name, Class<? extends DslJsr223Sampler.SamplerScript> scriptClass)DslJsr223Sampler(String name, String script)DslJsr223Sampler(String name, DslJsr223Sampler.SamplerScript script)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected org.apache.jmeter.util.JSR223TestElementbuildJsr223TestElement()protected DslJsr223Sampler.DslLambdaSamplerbuildLambdaTestElement()org.apache.jorphan.collections.HashTreebuildTreeUnder(org.apache.jorphan.collections.HashTree parent, BuildTreeContext context)Builds the JMeter HashTree for this TestElement under the provided tree node.DslJsr223Samplerchildren(BaseSampler.SamplerChild... children)Allows specifying children test elements for the sampler, which allows for example extracting information from response, assert response contents, etc.-
Methods inherited from class us.abstracta.jmeter.javadsl.core.testelements.DslJsr223TestElement
buildTestElement, language
-
Methods inherited from class us.abstracta.jmeter.javadsl.core.testelements.BaseTestElement
buildConfiguredTestElement, buildTestElementGui, configureTestElement, durationToSeconds, loadBeanProperties, showAndWaitFrameWith, showFrameWith, showInGui, showTestElementGui
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface us.abstracta.jmeter.javadsl.core.DslTestElement
showInGui
-
-
-
-
Field Detail
-
children
protected final List<BaseSampler.SamplerChild> children
-
-
Constructor Detail
-
DslJsr223Sampler
public DslJsr223Sampler(String name, DslJsr223Sampler.SamplerScript script)
-
DslJsr223Sampler
public DslJsr223Sampler(String name, Class<? extends DslJsr223Sampler.SamplerScript> scriptClass)
-
-
Method Detail
-
children
public DslJsr223Sampler children(BaseSampler.SamplerChild... children)
Allows specifying children test elements for the sampler, which allows for example extracting information from response, assert response contents, etc.- Parameters:
children- list of test elements to add as children of this sampler.- Returns:
- the sampler for further configuration or usage.
-
buildJsr223TestElement
protected org.apache.jmeter.util.JSR223TestElement buildJsr223TestElement()
- Specified by:
buildJsr223TestElementin classDslJsr223TestElement<DslJsr223Sampler,DslJsr223Sampler.SamplerVars>
-
buildLambdaTestElement
protected DslJsr223Sampler.DslLambdaSampler buildLambdaTestElement()
- Specified by:
buildLambdaTestElementin classDslJsr223TestElement<DslJsr223Sampler,DslJsr223Sampler.SamplerVars>
-
buildTreeUnder
public org.apache.jorphan.collections.HashTree buildTreeUnder(org.apache.jorphan.collections.HashTree parent, BuildTreeContext context)Description copied from interface:DslTestElementBuilds the JMeter HashTree for this TestElement under the provided tree node.- Specified by:
buildTreeUnderin interfaceDslTestElement- Overrides:
buildTreeUnderin classBaseTestElement- Parameters:
parent- 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).- Returns:
- The tree created under the parent node.
-
-