JMeter 3.1 - Upload file issue - jmeter

I am having problems trying to upload a file in JMeter 3.1.
In the HTTP Request, I have a POST request with the "User multipart/form-data for POST" option checked. Then I have File Path, Parameter Name and MIME type set, no problems there.
The issue is that the script is working on JMeter 2.13, but it keeps failing when running either on 3.0 or 3.1. The response code is 200, but it fails on the expected text "File successfully uploaded".
The only difference between 2.13 and 3.1 is that 3.1 adds the charset value on the Conent-Type Request Header (please find attached screenshots).
JMeter 2.13
Jmeter 3.1
Thanks in advance!

My expectation is that you have different HTTP Client Implementations
HTTP Request
this has an implementation drop-down box, which selects the HTTP protocol implementation to be used:
Java
uses the HTTP implementation provided by the JVM. This has some limitations in comparison with the HttpClient implementations - see below.
HTTPClient3.1
(DEPRECATED SINCE 3.0) uses Apache Commons HttpClient 3.1. This is no longer being developed, and support for this will be dropped in a future JMeter release.
HTTPClient4
uses Apache HttpComponents HttpClient 4.x.
Blank Value
does not set implementation on HTTP Samplers, so relies on HTTP Request Defaults if present or on jmeter.httpsampler property defined in jmeter.properties
Make sure you are using the same for both JMeter versions and you will get the same behaviour. If the value is blank you can check jmeter.httpsampler property value in jmeter.properties and/or user.properties files.
You can quickly change the implementation for all the samplers using HTTP Request Defaults.

Related

JMeter on startup returns multiple ERROR | Error filtering class org.bouncycastle.....information does not match

Every time I run JMeter I received multiple bouncycastle errors. I have checked I have the latest jar.
Any help would be appreciated.
By default JMeter doesn't contain the "bouncycastle" .jar file, as per Readme:
Some jars are not included with JMeter. If required, these should be downloaded and placed in the lib directory
JDBC - available from the database supplier
JMS - available from the JMS provider
Bouncy Castle - only needed for SMIME Assertion
Looking into gradle.properties
bouncycastle.version=1.67
So if you're using Bouncy Castle API somewhere i.e. in the SMIME Assertion (check out How to Use JMeter Assertions in Three Easy Steps for more details if needed) - make sure to have only one set of BC .jar files and preferably stick to version of 1.67 so JMeter implementation would match the API in .jars
If you don't use Bouncy Castle API just download and install the latest stable version of JMeter, it will not give you this error.

Does Apache JMeter support http/2 requests?

Does JMeter 3.2 support HTTP2 ?
HTTP2 is not supported by Core JMeter as of version 4.0
But there is a plugin that implements it.
This plugin can be installed by JMeter-Plugins Manager.
Regarding HTTP Client, since version 5.0 released on 18 January 2018, Http/2 is supported:
https://hc.apache.org/httpcomponents-client-5.0.x/index.html
http://mail-archives.apache.org/mod_mbox/hc-httpclient-users/201801.mbox/%3C1516280327.10018.3.camel%40apache.org%3E
To sample HTTP/2 requests, you can use a plugin for jmeter, such as this one: https://github.com/syucream/jmeter-http2-plugin
From the readme file:
Build Netty 5 (Alpha3+) and netty-tcnative for your platform
Copy HTTP2Sampler.jar, netty-all.jar, netty-tcnative.jar and
hpack.jar to lib/ext of jmeter directory
If you use gzip encoding, you must prepare jzlib.jar too.
Run JMeter
Write your test scenario with HTTP2Sampler
From HTTPClient 4.5 official docs:
Standards based, pure Java, implementation of HTTP versions 1.0 and
1.1
SO, you need to wait till HTTP/2 is implemented in HTTPClient libraries and Jmeter implements HTTP2 using the library and create a sampler for the same.

JSR223 Post Processor: ClassNotFoundException: org.apache.bsf.engines.java.JavaEngine

I'm trying to use a JSR223 post processor in jmeter 2.11 with some java code and I keep getting this error:
org.apache.bsf.BSFManager:Exception:java.lang.ClassNotFoundException:org.apache.bsf.engines.java.JavaEngine
I've checked the bsf/bsh jar files, not sure what else I need to do to make this work. I've read that groovy is recommended but I'd really like this to work with java.
As per the very first lines from BSF Sampler documentation:
See the Apache Bean Scripting Framework website for details of the languages supported. You may need to download the appropriate jars for the language; they should be put in the JMeter lib directory.
And at the same place:
The BSF API has been largely superseded by JSR-223, which is included in Java 1.6 onwards. Most scripting languages now include support for JSR-223; please use the JSR223 Sampler instead. The BSF Sampler should only be needed for supporting legacy languages/test scripts.
So I would recommend considering the following (in the order from worst to best performance provided)
Beanshell Sampler (if your Java code is doing something "light")
JSR223 Sampler + groovy language - for "heavy" operations (again you'll need to have groovy jar in your JMeter CLASSPATH)
Write your own implementation of Java Request Sampler
Both Beanshell and Groovy support Java syntax with some limitations which can be easily worked around.
See Beanshell vs JSR223 vs Java JMeter Scripting: The Performance-Off You've Been Waiting For! guide which might help you to make right selection.

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.

Apache Camel load external XSLT contentCache duration

I am using Apache Camel on a web-app and I want to call external xslt stylesheet.
I am using the absolute file URI (until now I was not able to use the relative file URI on Tomcat)
The Camel doc refer the following option :
contentCache default:true Camel 2.6: Cache for the resource content (the stylesheet file) when it is loaded. If set to false Camel will reloader the stylesheet file on each message processing. This is good for development.
But I haven't find anything about the duration of this cache.
Is there anyway to know the default value of this cache duration and to change it?
The content is cached without a timeout and there currently isn't an option to change it (see the source code here).
Feel free to log a CAMEL enhancement request in JIRA and we can possibly add support for specifying a custom timeout.

Resources