Jmeter says my browser is incompatible

A colleague was writing a script for a new application but was complaining that when he played back the script it was failing. He was seeing in the Results Tree for the page “Your browser is incompatible with this web site. Javascript must be enabled for this site to function”

This is because the default http header sent from Jmeter doesn’t support JavaScript. To get it to work he needed to copy the header from the original recording into the script.

Writing to the jmeter.log

I wanted to log some messages to the jmeter.log file during the script execution to help with debugging. The great thing with the jmeter.log file is that you can see it from both the GUI or the comand line. To write to the jmeter.log all you need to do is use< log.info("YOUR TEST") It will even write out variables as long as they are encased in ${}.

Error invoking bsh method on FileOutputStream

I have written a beanshell sampler that opens a file and outputs some variables. However, I got the following error.

Error invoking bsh method: eval Sourced file: inline evaluation of: ``f = new FileOutputStream("C:\\xxxxx.csv", true); ;'' : Object constructor

I found out that it was failing because I did not have the correct permission for directory in which the file was supposed to be written. Change the location and it worked fine!

Jmeter with Seperate Scenario file

I wanted to start running the same Jmeter test plan but for different scenario i.e. number of users etc. I had setup all the paramters in a user defined variables and changed these between run but this lead to seperate test plan files with different scenarios. The problem any change to the plan other than the variables needed to be replicated across all the test plan. There for I wanted a file that can included in the command line call when invoking Jmeter and at the same time I still wanted the ability to set the paramter via the GUI.

To do this I used the __P property function. The line below will use the pUser property if it is defined via the command line if it is not ie. from a plan invocation of the GUI it will use the value 20.

${__P(pUser,20)}

Here is an example in a dummy test plan

set4scenario

Next I needed to set up a properties file containing the property / value pairs. In this example I created a file peak.properties with a single line.

pUser=1000

Then to run this from the command line I insert the -q peak.properties following to the command line.

jmeter -n -t MyTestPlan.jmx -q peak.properties

Unreadable data in the tree listener

I was recording a Siebel script in Jmeter but discovered that the data coming back was unreadable in the tree listener (see below):
compressed data

The key problem was that any Regular expressions to pull out parameters would not work. This problem was easily solved by removing the Accept-Encoding line from the Jmeter request HTTP header.

http header

Not ideal as the data will be return uncompressed so there will be more stress on the network, so something to be mindful of when looking at the Jmeter results.

Jmeter and ZLIB input stream error

Today I was trying to record a Jmeter Siebel script, and got the following error when I did the recording.

java.io.EOFException: Unexpected end of ZLIB input stream at java.util.zip.InflaterInputStream.fill…

I solved this by setting the HTTP sampler to Java

ZLIB input stream

I still have the problem that the data is encoded by that is another challange.

Print jmeter variables in ouput .CSV

I wanted to output the variables used by the Jmeter thread when a sampler executed. I have already setup jmeter to output an excel file (see here) . To do this I needed to change the jmeter.properties file to append the list of jmeter variables I wanted outputted. An example is shown below for the three variables pLicense,pName,pPostcode,pNumber

# Optional list of JMeter variable names whose values are to be saved in the result data files.
# Use commas to separate the names. For example:
sample_variables=pName,pAddress,pPostcode,pNumber