Class DslDummySampler
- java.lang.Object
-
- us.abstracta.jmeter.javadsl.core.testelements.BaseTestElement
-
- us.abstracta.jmeter.javadsl.core.testelements.TestElementContainer<T,BaseSampler.SamplerChild>
-
- us.abstracta.jmeter.javadsl.core.samplers.BaseSampler<DslDummySampler>
-
- us.abstracta.jmeter.javadsl.core.samplers.DslDummySampler
-
- All Implemented Interfaces:
DslTestElement,DslSampler,BaseThreadGroup.ThreadGroupChild
public class DslDummySampler extends BaseSampler<DslDummySampler>
Allows using JMeter Dummy Sampler plugin to emulate other samples and ease testing post processors and other parts of a test plan.By default, this element is set with no request, url, response code=200, response message = OK, and response time with random value between 50 and 500 milliseconds. Additionally, emulation of response times (through sleeps) is disabled to speed up testing.
- Since:
- 0.46
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classDslDummySampler.CodeBuilder-
Nested classes/interfaces inherited from class us.abstracta.jmeter.javadsl.core.samplers.BaseSampler
BaseSampler.SamplerChild
-
-
Field Summary
Fields Modifier and Type Field Description protected StringrequestBodyprotected StringresponseBodyprotected StringresponseCodeprotected StringresponseMessageprotected StringresponseTimeprotected booleansimulateResponseTimeprotected booleansuccessfulprotected Stringurl-
Fields inherited from class us.abstracta.jmeter.javadsl.core.testelements.TestElementContainer
children
-
Fields inherited from class us.abstracta.jmeter.javadsl.core.testelements.BaseTestElement
guiClass, name
-
-
Constructor Summary
Constructors Constructor Description DslDummySampler(String name, String responseBody)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected org.apache.jmeter.testelement.TestElementbuildTestElement()DslDummySamplerrequestBody(String requestBody)Specifies the request body used in generated sample results.DslDummySamplerresponseCode(String code)Specifies the response code included in generated sample results.DslDummySamplerresponseMessage(String message)Specifies the response message included in generated sample results.DslDummySamplerresponseTime(String responseTime)Same asresponseTime(Duration)but allowing to specify a JMeter expression for evaluation.DslDummySamplerresponseTime(Duration responseTime)Specifies the response time used in generated sample results.DslDummySamplersimulateResponseTime(boolean simulate)Specifies if used response time should be simulated (the sample will sleep for the given duration) or not.DslDummySamplersuccessful(boolean successful)Allows generating successful or unsuccessful sample results for this sampler.DslDummySamplerurl(String url)Specifies the URL used in generated sample results.-
Methods inherited from class us.abstracta.jmeter.javadsl.core.samplers.BaseSampler
children
-
Methods inherited from class us.abstracta.jmeter.javadsl.core.testelements.TestElementContainer
buildTreeUnder
-
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
buildTreeUnder, showInGui
-
-
-
-
Field Detail
-
responseBody
protected String responseBody
-
successful
protected boolean successful
-
responseCode
protected String responseCode
-
responseMessage
protected String responseMessage
-
responseTime
protected String responseTime
-
simulateResponseTime
protected boolean simulateResponseTime
-
url
protected String url
-
requestBody
protected String requestBody
-
-
Method Detail
-
successful
public DslDummySampler successful(boolean successful)
Allows generating successful or unsuccessful sample results for this sampler.- Parameters:
successful- when true, generated sample result will be successful, otherwise it will be marked as failure. When not specified, successful sample results are generated.- Returns:
- the sampler for further configuration or usage.
-
responseCode
public DslDummySampler responseCode(String code)
Specifies the response code included in generated sample results.- Parameters:
code- defines the response code included in sample results. When not set, 200 is used.- Returns:
- the sampler for further configuration or usage.
-
responseMessage
public DslDummySampler responseMessage(String message)
Specifies the response message included in generated sample results.- Parameters:
message- defines the response message included in sample results. When not set, OK is used.- Returns:
- the sampler for further configuration or usage.
-
responseTime
public DslDummySampler responseTime(Duration responseTime)
Specifies the response time used in generated sample results.- Parameters:
responseTime- defines the response time associated to the sample results. When not set, a randomly calculated value between 50 and 500 milliseconds is used.- Returns:
- the sampler for further configuration or usage.
-
responseTime
public DslDummySampler responseTime(String responseTime)
Same asresponseTime(Duration)but allowing to specify a JMeter expression for evaluation.This is useful when you want response time to be calculated dynamically. For example,
${__Random(50, 500)}- Parameters:
responseTime- specifies the JMeter expression to be used to calculate response times, in milliseconds, for the sampler.- Returns:
- the sampler for further configuration or usage.
- Since:
- 1.0
- See Also:
responseTime(Duration)
-
simulateResponseTime
public DslDummySampler simulateResponseTime(boolean simulate)
Specifies if used response time should be simulated (the sample will sleep for the given duration) or not.Having simulation disabled allows for really fast emulation and trial of test plan, which is very handy when debugging. If you need a more accurate emulation in more advanced cases, like you don't want to generate too many requests per second, and you want a behavior closer to the real thing, then consider enabling response time simulation.
- Parameters:
simulate- when true enables simulation of response times, when false no wait is done speeding up test plan execution. By default, simulation is disabled.- Returns:
- the sampler for further configuration or usage.
-
url
public DslDummySampler url(String url)
Specifies the URL used in generated sample results.This might be helpful in scenarios where extractors, pre-processors or other test plan elements depend on the URL.
- Parameters:
url- defines the URL associated to generated sample results. When not set, an empty URL is used.- Returns:
- the sampler for further configuration or usage.
-
requestBody
public DslDummySampler requestBody(String requestBody)
Specifies the request body used in generated sample results.This might be helpful in scenarios where extractors, pre-processors or other test plan elements depend on the request body.
- Parameters:
requestBody- defines the request body associated to generated sample results. When not set, an empty body is used.- Returns:
- the sampler for further configuration or usage.
-
buildTestElement
protected org.apache.jmeter.testelement.TestElement buildTestElement()
- Specified by:
buildTestElementin classBaseTestElement
-
-