SPONSORS:






View RSS Feed

Ronak

Understanding JMeter Element- Java Request Sampler

Rate this Entry
by , 06-21-2015 at 01:51 AM (423 Views)
Understanding JMeter Element- Java Request Sampler

This sampler lets you control a java class that implements the org.apache.jmeter.protocol.java.sampler.JavaSample rClient interface. By writing your own implementation of this interface, you can use JMeter to harness multiple threads, input parameter control, and data collection.

The pull-down menu provides the list of all such implementations found by JMeter in its classpath. The parameters can then be specified in the table below - as defined by your implementation. Two simple examples (JavaTest and SleepTest) are provided.

The JavaTest example sampler can be useful for checking test plans, because it allows one to set values in almost all the fields. These can then be used by Assertions, etc. The fields allow variables to be used, so the values of these can readily be seen.

If the method teardownTest is not overriden by a subclass of AbstractJavaSamplerClient, its teardownTest method will not be called. This reduces JMeter memory requirements. This will not have any impact on existing Test plans.

The Add/Delete buttons don't serve any purpose at present.
Parameters
Name- Descriptive name for this sampler that is shown in the tree.
Classname- The specific implementation of the JavaSamplerClient interface to be sampled.
Send Parameters with Request- A list of arguments that will be passed to the sampled class. All arguments are sent as Strings. See below for specific settings.

The following parameters apply to the SleepTest and JavaTest implementations:
Parameters
Sleep_time- How long to sleep for (ms)
Sleep_mask- How much "randomness" to add:
The sleep time is calculated as follows:
totalSleepTime = SleepTime + (System.currentTimeMillis() % SleepMask)

The following parameters apply additionaly to the JavaTest implementation:
Parameters
Label- The label to use. If provided, overrides Name
ResponseCode- If provided, sets the SampleResult ResponseCode.
ResponseMessage- If provided, sets the SampleResult ResponseMessage.
Status- If provided, sets the SampleResult Status. If this equals "OK" (ignoring case) then the status is set to success, otherwise the sample is marked as failed.
SamplerData- If provided, sets the SampleResult SamplerData.
ResultData- If provided, sets the SampleResult ResultData.



Disclaimer: The article/post is posted with the purpose of sharing knowledge and information.
The article may contain references, extract or content from other informative sources.
Researched/Authored/Compiled by -
Ronak Shah
Practice Head - Software Testing (QA), CIGNEX Datamatics

vBulletin Optimisation provided by vB Optimise v2.6.0 Beta 4 (Pro) - vBulletin Mods & Addons Copyright © 2016 DragonByte Technologies Ltd.
User Alert System provided by Advanced User Tagging v3.0.9 (Pro) - vBulletin Mods & Addons Copyright © 2016 DragonByte Technologies Ltd.
Questions / Answers Form provided by vBAnswers (Pro) - vBulletin Mods & Addons Copyright © 2016 DragonByte Technologies Ltd.
vBNominatevBulletin Mods & Addons Copyright © 2016 DragonByte Technologies Ltd.
Username Changing provided by Username Change (Free) - vBulletin Mods & Addons Copyright © 2016 DragonByte Technologies Ltd.
BetaSoft Inc.
Digital Point modules: Sphinx-based search
All times are GMT -8. The time now is 11:02 PM.

Copyright BetaSoft Inc.