jMeter ignoring Thread groups - jmeter

I am using jMeter to do some performance testing.
All thread groups are almost identical - differs only in name and in http request inside (see structure below). Although all are defined the same, the run seems to ignore some of those. Only two out of 10 are running.
I have set the log level to debug and there is still no mention of the other TG (thread groups). It's not even first two that would work, but more like third and fifth or so.
Doesn't make any sense to me. Any ideas?
I have following definition:
Test Plan
- variables#1 - constants
- variables#2 - environment variables (user defined)
- variables#3 - another variables used to enable/disable certain tests
- CSV dataset config - data#1
- CSV dataset config - data#2
- HTTP Request defaults (hostname, protocol and port are defined) + implicit parameters (e.g. callingApp=jmeter - part of GET in url)
-view results tree
-log aggregate report
-thread group A (arrivals - extension)
--If Controller*1
---HTTP request with specific path
----some assertions
-thread group B - E (all are the same as A, only different urls are used)
Ran using:
$config="-DrampUpTime=1 ..."
mvn clean verify $config
Didn't find anything in related logs or any of the settings
Related pom.xml bits:
plugin:com.lazerycode.jmeter:jmeter-maven-plugin:2.9.0
plugin-<config>
<jmeterVersion>5.1.1</jmeterVersion>
<overrideRootLogLevel>DEBUG</overrideRootLogLevel>
<resultsFileFormat>jtl</resultsFileFormat>
<jmeterExtensions>
<artifact>kg.apc:jmeter-plugins-casutg:${jmeter.plugins.catsug.version}</artifact>
</jmeterExtensions>

Shoot me now. Just found it.
<com.blazemeter.jmeter.threads.arrivals.ArrivalsThreadGroup guiclass="com.blazemeter.jmeter.threads.arrivals.ArrivalsThreadGroupGui" testclass="com.blazemeter.jmeter.threads.arrivals.ArrivalsThreadGroup" testname="/something/something/something" enabled="false">
enabled="false"
Apparently there is a possibility to disable the test and for fun it only differs in slightly more gray font (in the dark theme) in GUI.
On my defense, I did not create the test suite, so at least it was not me, who disabled it.
wastedHoursCounter=5;

Related

Strange labels with suffix -0, -1 in jmeter results

We recently updated apache jmeter from v4.0 to the latest v5.4.3.
The tests are running fine, but we have strange results.
The requests appear with 3 different labels (without suffix or -0 / -1 appended).
timeStamp, label, responseCode, threadName
1643834640785, API call, 200, Load Group 1 1-1
1643834640785, API call-0, 302, Load Group 1 1-1
1643834641189, API call-1, 200, Load Group 1 1-1
1643834640785, API call, 200, Load Group 1 1-2
....
It seems to me this happens, when the same thread calls the API multiple times.
I am not a jmeter and I am not sure why this happens and how to fix it. Also I don't know what information is needed to analyze the problem correctly.
Thanks in advance!
I'm seeing HTTP Status 302 which means redirection (for example from HTTP to HTTPS or from global website to country-specific website), in that case JMeter generates additional Sub-Result.
The "strange" labels is how JMeter calculates throughput for embedded resources and the cumulative execution time of the parent sampler in case of redirects as well.
The question is what do you want to do with this.
The options are in:
Take it for granted given the above explanation
If you want the "strange" labels to be resolved into real URLs - tick "Functional Testing" box in the Test Plan
or add the next line to user.properties file:
subresults.disable_renaming=true
If you want to get rid of these subresults completely - add the next line to user.properties file:
jmeter.save.saveservice.subresults=false
More information:
Configuring JMeter
JMeter Properties Reference

JMeter - Hitting specific endpoints based on user credentials via multiple CSV files

My JMeter test:
Iterate over a CSV file (logins.csv) with login credentials, and their unique identifier user a CsvDataSetConfig
Sign in
Based on the login credentials (unique identifier from logins.csv), identify and load a second file in the format of <user_identifier>_invoices.csv which then has the necessary path to view an invoice for that user.
Simplified test setup:
ThreadGroup
> CsvDataSetConfig - file: logins.csv, variables: user_identifier,email,password, sharing_mode: all threads
> `SignIn` TransactionController using email and password from above CSV file to login via series of HTTP Requests
> UserParameters - USER_IDENTIFIER,INVOICE_CSV_FOR_USER
> BeanShellSampler
props.setProperty("USER_IDENTIFIER", vars.get("user_identifier"));
props.setProperty("INVOICE_CSV_FOR_USER","${__P(USER_IDENTIFIER)}_invoices.csv");
> WhileController - condition: ${__javaScript("${invoice-id}" != "<EOF>",)}
> CsvDataSetConfig - file: ${__P(INVOICE_CSV_FOR_USER,)}, variables: invoice-id, sharing_mode: current thread
> `ViewInvoice` TransactionController with HTTP Request to url `../${invoice-id}`
# logins.csv
c7beaa99c6d99fa7754fc2213f9b17b8,foo#example.com,password321
9c8466bee65e39c9d3cf715e42933c3b,bar#example.com,password456
# c7beaa99c6d99fa7754fc2213f9b17b8_invoices.csv
f54eca1cbbba4a97c1dc459e0ba64970
0024f2cdf28dd7ebf3606988fd229afd
# 9c8466bee65e39c9d3cf715e42933c3b_invoices.csv
64f725fdeb2980b28bdf5e02076a55cd
60ac45a12ea3d6b59c2cb82f27da1722
Problem:
In local JMeter, seeing requests to invoice urls being made with incorrect invoice-id for the business. So seems the parameters are not being treat correctly between threads.
In BlazeMeter, seeing the content of the while controller never being hit.
I've tried loop controllers, having 50 rows per _invoices.csv file, but not got anywhere with that either. I also originally started off with
User Defined Variables rather than User Parameters, but the latter seems to be what I should be using for this use case.
Threads are running at the same time and sharing JMeter properties.
In your test plan each thread sets the property USER_IDENTIFIER. So this and other property can/will be overriden by different thread(s) and create inconsistency.
I suggest you save (and get) in variables which aren't shared by threads:
vars.put("USER_IDENTIFIER", vars.get("user_identifier"));
vars.put("INVOICE_CSV_FOR_USER"," ${USER_IDENTIFIER}_invoices.csv");
Also about beanshell, JMeter advice to change to JSR223
Since JMeter 3.1, we advise switching from BeanShell to JSR223 Test Elements (see JSR223 section below for more details), and switching from __Beanshell function to __groovy function.

Running JMeter in Command mode is not creating any log for anything under while loop in .jmx file

I have a .jmx file with two thread groups. The first thread group is for data comparison (DB Vs API) and has a JDBC request where I plugin my SQL script and saves it to a tab delimited file. Then I have a while loop under which I have an HTTP request.
Second thread group for negative scenarios validation.
Below is the structure of the .jmx file
-- Thread Group Name - FX-Rates
-- JDBC Request Name - FX-SQL
-- While loop
-- HTTP Request - FX Rates - API
-- Thread Group Name - Negative Testing
-- Error Codes
I am running JMeter in Non GUI mode using below command.
jmeter -n -t "F:\MY DOCUMENTS\PSM\PSM_Automation\bin\Non_GUI_FX_Rates_Validation.jmx" -l "F:\MY DOCUMENTS\PSM\PSM_Automation\log\Non_GUI_FX_Rates_Validation.jtl"
I see that it is creating log for each individual sampler i.e; SQL and negative scenarios but not for anything under while loop. Below is the log that it created.
Logfile:
timeStamp,elapsed,label,responseCode,responseMessage,threadName,dataType,success,failureMessage,bytes,sentBytes,grpThreads,allThreads,Latency,IdleTime,Connect
1492185939615,12140,FX - SQL,200,OK,FX Rates 1-1,text,true,,18549,0,1,1,12017,0,1566
1492185951933,0,Error 400: Invalid Date Format,Non HTTP response code: java.net.URISyntaxException,Non HTTP response message: Illegal character in query at index 80: https://sys-fxrt-v0.apps.system.pcf.ntrs.com/foreign-exchange-rates?as-of-date=${D_EXCH_RT_EFF},Negative Testing - Error Codes 2-1,text,false,,1105,0,1,1,0,0,0
1492185951935,190,Error 404: No Account,404,Not Found,Negative Testing - Error Codes 2-1,text,true,,354,232,1,1,189,0,170
1492185952127,20,Error 404: Incorrect URL,404,Not Found,Negative Testing - Error Codes 2-1,text,false,,354,241,1,1,19,0,12
1492185952147,19,Error 204: No Data ,404,Not Found,Negative Testing - Error Codes 2-1,text,true,,354,260,1,1,19,0,12
Obviously, the kind of sampler result is there:
Error 400: Invalid Date Format,Non HTTP response code: java.net.URISyntaxException,Non HTTP response message: Illegal
character in query at index 80:
https://sys-fxrt-v0.apps.system.pcf.ntrs.com/foreign-exchange-rates?as-of-date=${D_EXCH_RT_EFF}
Obviously that is because the D_EXCH_RT_EFF is not set/resolved in your URL.
That's the problem you're gonna debug.
Obviously.
If you're already doing that (debugging), and run into a problem during it - then describe it please.
And show two things: how you set (initialize) the variable; how you use it, means, literally, show your HTTP sampler (yes, screenshot, at least).
The reasons of not entering the "While Loop" can be in:
While condition is returning false
While condition is wrong
If your While Condition depends on a variable coming from JDBC Request Name - FX-SQL sampler - double check this variable value using Debug Sampler and View Results Tree listener combination.
General "good practice" is running your test with 1-2 virtual users in GUI mode and inspect requests and responses details in the View Results Tree listener. Also pay attention to any suspicious entries in jmeter.log file. Don't run your JMeter test with the full load until you are totally sure that it is doing what it is supposed to be doing. See How to Debug your Apache JMeter Script article for more information on JMeter tests troubleshooting techniques.

How to view all information relative all slave machines in jmeter in real time

I configured my test in this way (in windows 7):
1 Virtual machine is master, that run all vm slaves with the command for a distribuited testing (from command line) and show in jmeter GUI some graphs (for example jp#gc Active thread over time , hits/sec, response time, etc..).
3 Virtual machine are slave, to execute the testing;
When master run the "start" to 3 slave, the test works (each slave run 6 thread), and in the GUI on master, there are only 6 thread in the graph (jp#gc - Active Threads Over Time), but in reality are 18 (6 thread for slaves, with 3 slaves).
So my question is: how can I see the total data for all slaves?
jp#gc - Active Threads Over Time = to see 18 thread (thread slave1 +thread slave2+thread slave3)
jp#gc - Hits per Second = Hits slave 1 +Hits slave 2+ Hits slave 3
and so on...
You need to add __machineName or __machineIP function so the listeners could distinguish results coming from different nodes.
Also be aware of mode property which is configured to send results from slave machines each 100 results or each minute (whatever comes the first) so you might want to amend it, i.e. add mode=Standard line to user.properties file on each slave node.
# Remote batching support
# Since JMeter 2.9, default is MODE_STRIPPED_BATCH, which returns samples in
# batch mode (every 100 samples or every minute by default)
# Note also that MODE_STRIPPED_BATCH strips response data from SampleResult, so if you need it change to
# another mode
# Hold retains samples until end of test (may need lots of memory)
# Batch returns samples in batches
# Statistical returns sample summary statistics
# hold_samples was originally defined as a separate property,
# but can now also be defined using mode=Hold
# mode can also be the class name of an implementation of org.apache.jmeter.samplers.SampleSender
#mode=Standard
#mode=Batch
#mode=Hold
#mode=Statistical
See Apache JMeter Properties Customization Guide for more information on working with JMeter properties.
Be aware that sending results in case of severe load may cause network IO overhead so it might be a good idea to consider Backend Listener instead
Add the Machine Info function to the thread group name area as shown below:

Thrift API load test

I am new into Apache Jmeter. Basically I want to load test our couple of thrift APIs but have no clue where to start with. It is in java where api takes 2 parameter and then send java object as response.
Any pointer would be very helpful.
JMeter isn't especially for it but it's flexible enough to support your use case.
There is an extensibility mechanism which uses BeanShell. JMeter provides BeanShell Sampler which is capable of invoking Java code, including using external jars.
Simple usage:
Start with empty JMeter project
Create a Thread Group with all defaults (you can play with number of threads, ramp-up, etc)
Add a BeanShell Sampler with following code:
Thread.sleep(2000L);
Add View Results Tree listener
Save and run
You should see a green triangle (or triangles) basing on your number of threads and loops) with output like following:
Thread Name: Thread Group 1-1
Sample Start: 2013-11-02 14:48:11 GMT+03:00
Load time: 5030
Latency: 0
Size in bytes: 0
Headers size in bytes: 0
Body size in bytes: 0
Sample Count: 1
Error Count: 0
Response code: 200
Response message: OK
If you use any of techniques to analyze results, i.e.
JMeter embedded listeners like Aggregate Report, Summary Report, Graph Resuls, etc.
Storing results to CSV file and opening them with Excel or equivalent (see jmeter.properties file under /bin directory of your JMeter installation. Properties prefix is "jmeter.save.saveservice."
JMeter Ant Task (see Test.jmx and build.xml in /extras folder under your JMeter installation)
JMeter Results Analysis Plugin
You'll see your request(s) success rate, min/max/average times (something like 2 seconds I guess) and some more information (depending on your configuration).
Particular your use case assumes
IMPORTANT Placing thrift (or whatever) jars under lib/ext folder (or you won't be able to access your APIs
importing classes you need to test somewhere in BeanShell Sampler
import yourpackage.YourClass;
Invoking methods you want to test from BeanShell Sampler
(optional) do some assertions on responses. i.e.
if (yourresponse != yourexpectedresponse){
IsSuccess=false;
ResponseMessage= "Test Failed";
}
Hope this helps
You can use JSR223 Sampler + Groovy (add groovy-all.jar in jmeter/lib) and look at this client example, see NonblockingClient code for an example:
http://www.javacodegeeks.com/2012/03/apache-thrift-quickstart-tutorial.html
Make your groovy code call a least the following at end:
SampleResult.setSuccessful(true/false)
SampleResult.setResponseCode("code")
SampleResult.setResponseMessage("message")
See:
http://jmeter.apache.org/usermanual/component_reference.html#JSR223_Sampler
And of course, ensure you add the required dependencies in jmeter/lib.
I have writtena CustomThriftSampler for JMeter to load test HBase through thrift service. You can get the details about it at my blog - http://1-st.blogspot.in/2013/12/load-testing-thrift-services-custom.html . Couldn't create a generalized code. Anyway its simple and starightforward java code. Anyone could try it. If time permit I shall write a generalised code and commit to github!!

Resources