简体   繁体   中英

Are Java Request samplers as accurate as SOAP or HTTP samplers in jmeter?

Are Java Request samplers as accurate as SOAP or HTTP samplers in jmeter? For example, I run a java request sampler which reads from a csv file and handles entries in the file through code. This causes 0 throughput in the results. However, when I use HTTP or SOAP samplers I get higher throughput since the entries of the csv file are handled one at a time through Jmeter not through the java code. Any clues on how to solve this "inaccuracy" in the Java sampler results? Related to this question is: if I use the Java Request Sampler Test class to merely call a static method in another java class. Is that a good practice or the whole logic should be inside the runTest method? Thank you.

Java Request Sampler is pretty much alike any other sampler.

Make sure that you invoke sampleStart() and sampleEnd() methods at the beginning and in the end of your test.

See Java Request section of Beanshell vs JSR223 vs Java JMeter Scripting for example Java Request Sampler source code.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM