Performance Test - Distributed mode with jtl and smtp listener - jmeter

My test consists of tear down thread that sends the JTL report in the email through SMTP listener. This works fine when I run the tests in non distributed model as the JTL file is in one machine.
The issue I am facing is when I run these tests in distributed mode ( for some heavy loads). SMTP listener fails as the file is not found in the slave where the tests are running since JTL file is in the master. is there anyway I can make this work within the JMeter tests or do I need to create a separate script once the test is done to send the final report through email.

The easiest option would be indeed creating a separate test script for sending the results.
Alternative option would be
kicking off another JMeter Slave instance at the same host with the master
Limiting the SMTP Sampler to be executed only on that host via If Controller and __machineName() or __machineIP() functions combination like this:
This way you will be able to run SMTP Sampler only on the machine where the .jtl file lives.

Related

JMeter won't write response data

I'm running tests with JMeter (master+10 slaves) on elasticasearch. I'm getting error 400 for some requests but they are a bit elusive:
When I run the requests manually with curl or pasting them on kibana's console, I don't get errors.
Every time I run the tests using jmeter, using the same requests and under the same conditions, I get a different number of errors.
So I was thinking of inspecting the response bodies from jmeter. But all the ways I've tried failed:
I've created a View Result Tree element and checked all boxes on the "configure" panel. When I run the script, it logs everything except response data
I've tried a BeanShell post processor to write all responses on a file. But it apparently is being 'ignored' when I run the script
Both these solutions work on my machine, but not on the server (which I don't have total control over). I'm passing jmeter.save.saveservice.response_data=true on the command line to start jmeter.
What else could I try?
This is an optimization that JMeter makes for distributed testing related to the mode:
https://jmeter.apache.org/usermanual/properties_reference.html#remote_batching_config
To avoid JMeter stripping the response data set in user.properties of servers snd controller:
mode=Batch
As by default it is:
mode=StrippedBatch
By default JMeter slaves don't send response data to the master, you can choose a different sample sender if you need more data.
Writing response data into a file using Beanshell should work in any case (however consider using JSR223 Test Elements and Groovy for this), just make sure that:
your Beanshell PostProcessor is placed correctly according to JMeter Scoping Rules
there are no Beanshell-related messages in jmeter.log files
you will need to collect the log files from each slave manually after test run, they will not be generated on the master

JMeter distributed testing - how to get aggregated report?

I have three slaves (jmeter-servers) running on EC2 instances, and in one case – (1) JMeter GUI on a local laptop, on another – same test plan (2) running from a command line on yet another EC2 instance.
In case of GUI I can see all the aggregated numbers for Throughput, 99%, etc. in – well, GUI. I'm creating a jtl file with Aggregate Report listener.
From watching Datadog charts monitoring the application server parameters (CPU usage, memory, etc.) I see that in case of a command line and everything on EC2 load is more than twice higher than when my local laptop is communicating with the jmeter-servers, meaning probably that the network becomes a bottleneck. So I want to run everything on EC2.
But then – how do I get access to the same aggregated numbers when I'm running from the command line when all four machines are EC2 instances? The huge jtl file contains records for each transaction, not the aggregated one line of the entire run result.
On an attempt to download that jtl from EC2 and open it in GUI on a local laptop it generates some error instead of showing aggregated data.
Am I using a wrong listener to get to the summary data? (Tried Summary Report – it creates even larger jtl file, not the one line I'm looking for.)
Problem in this case is not running scripts via JMeter GUI. Instead it is related to network.
I had a similar distributed setup in EC2-environment and I successfully executed heavy load tests in GUI mode. In my case, all my JMeter (master/slaves) were running on EC2 instances (windows environment). So, I will recommend you to setup your JMeter (Master) on EC2 and run scripts via GUI mode.
If you still want to run in command line mode then you simply need to pass command to create jtl file while the script runs on command line. Later on you can use this JTL to generate any JMeter report as per requirement. For more details check..
Jmeter - Run .jmx file through command line and get the summary report in a excel
jmeter -n -t /path/to/your/test.jmx -l /path/to/results/file.jtl
Please refer to Dmitri answer in following question to reduce JTL size.
How can we control size of JTL file while running test from Non GUI Mode

Is it possible to reuse created jmeter test plan for another test environment?

I have recorded a jmeter script for wiki page. That record was done in one of our test environment. That script is working fine and now i want to perform same load test for another test environment(Both environments are same, only urls are different).Is it possible to reuse?How can i do it?
I have added HTTP Request default element at the begging of test plan creation. Now recorded script consist of many HTTP Request element. Each request element contains Server IP of test instance.
Extract IPs and other env-specific data to .properties file:
http://jmeter.apache.org/usermanual/get-started.html#options
Read them in your JMeter with JMeter built-in function ${__P(someName)} as you see fit
Run your generic JMeter test with env-specific config data in .properties file
Yes. It is possible to run the same test in multiple environments. It all depends on how you design your test plan.
This site has exact details you are looking for.
http://www.testautomationguru.com/jmeter-manage-test-plan/

execute jmeter test plan inside cucumber step in ruby

This must be easy but I am struggling so I post it here. I am new to Jmeter, and I have to use it to send messages. I am testing a messaging portal which uses a core messaging application where the portal gets the data from this application. Now there are clients who connect to this messaging application and when they send messages, the application processes it and the portal application displays it. I am using JMeter right now as a test harness simulating the client interface to send these test messages. My colleage who knows JMeter has created the .jmx file which has all the settings, the url, thread count,format of the message. All I have to do is open the .jmx file in GUI or on command line and send it. It works. I wanted this process of JMeter sending the messages automated in my cucumber step. So that when I write a step like:
'Given when clients sends a message'
then the step definition would be a command or script to execute the JMeter test plan.
I tried doing this by giving the line in my step definition:
system('start jmeter.bat -n -t sample.jmx ')
I am using ruby and the system command is the ruby way to execute external commands, in this case it is a windows command. -n is to run the JMeter in non-GUI mode and -t is to mention the .jmx file. The problem I have here is, anytime I run the JMeter in non-GUI mode, it opens a terminal, executes and the control stays there. So when I use this script in my cucumber steps, the control stays there in terminal and my cucumber scenarios fails.
How can I do this in a different way so that the JMeter test plan gets executed in the background or I get the control back to my cucumber step?
Note: I may have a solution using the ruby-jmeter gem : https://github.com/flood-io/ruby-jmeter but I am not finding a way how to simply execute this using the gem. Here in the gem he tells of running the test plan locally or on flood-io but not at a different url. In my case the url is an IP address where the messaging application is listening and I use JMS publisher in JMeter to send messages via GUI. I created the .jmx file using the GUI and the same can be used in command line successfully. Please let me know of any solutions.

Fetch response times in JMeter running remotely

Ok so I set up my JMeter to run remotely using one slave computer (possibly more to come), and it's working out for the most part EXCEPT that I can't fetch the response time over time-graphs function using the JMeter plugin. I'm still able to use the "PerfMon Metrics" tool to get the CPU/Memory values from the slave computer, so I don't understand how I'm not able to get the response time results.
Does anyone have any experience using that function?
I would check the master- slave configuration: be sure that
the same Jmeter release is used
same directory tree structure is used
Jmeter-plugins are installed on both systems
...
If you use a standard "Summary report" listener, and save data to a file in the master, then you can reload and analyse the data off line with any listener.
HTH

Resources