How to send multiple JMS messages Point to Point JMeter? - jmeter

I am using Jmeter for performance testing.I am using JMS point to point sampler.
I have 30000 raw message which is needed to push in websphere mq?
Can anyone let me know how to accomplish this?
Note: A raw message can be used once.NO DUBLICATION ALLOWED.
Thanks in Advance,
AJ

JMeter offers several functions which return random data, for instance:
__Random - generates random integer
__RandomString - generates random string
__UUID - generates GUID-like structure
__threadNum - returns current thread number
__counter - can be used to get current iteration
See official documentation or How to Use JMeter Functions post series for more information on above and other useful functions.

Related

How to get body message from every failed sampler in JMeter thread group

I am new to jMeter so hope you can help me out.
I have a thread group with several HTTP request samplers. I am sending an email every time any sampler fails. The thing is I would like to collect the names + response bodies of the several failed samplers to send in the email.
Can anybody please give an example of how to do it?
The best solution would be using Simple Data Writer listener configured to save only failed requests, there you can choose whatever metrics you need to store:
Another option is using JSR223 test elements and Groovy language to extract the "interesting" fields from the failed requests:
in the above example the sampler gets the label and the body from the previous result and stores them into ${requestName} and ${responseData} JMeter Variables which you can use wherever you want. More information on these prev, vars and other JMeter API shorthands: Top 8 JMeter Java Classes You Should Be Using with Groovy

How to Capture Jmeter test metrics like test start time, end time, number of users and pass it to rest API call

I am new to JMeter. I have two scripts one script is web and another is a rest api call which posts metrics to server. Both the scripts are working fine. Now i wanted to implement a scenario.
Web Script should run first once the script is completed i need to capture test metrics like start time, end time, load rate (No.of threads), Pass or fail save to a variable and pass these values to the rest api call which will then run and post the metrics to the server.
Any help is appreciated
Start time - can be obtained as ${TESTSTART.MS} JMeter pre-defined variable
End time - can be obtained via __time() function, if you call it somewhere in tearDown Thread Group it will report the time when all the main Thread Group(s) are done
Number of threads - it's a kind of weird requirement because its you who define the number of virtual users. Anyway, you can obtain it at any moment of time using i.e. __groovy() function like:
${__groovy(ctx.getThreadGroup().getNumberOfThreads(),)} - returns the number of threads which are active currently
${__groovy(ctx.getThreadGroup().getNumThreads(),)} - returns the number of threads which are defined in the Thread Group
As you are planning for the given scenarios you need to do following things.
1) You need to user jp#gc listeners to measure the results in (response time, threads per minute/seconds, hits per second and many more)
You can find the list of listeners here >> https://jmeter-plugins.org/wiki/GraphsGeneratorListener/
2) You need to implement the test plan using regular expression extractor for taking values from the response requests which you can store in the variables and later pass on to the dependent requests. for documentation visit https://jmeter.apache.org/usermanual/regular_expressions.html
For general understanding you can go through the jmeter official documentation
https://jmeter.apache.org/usermanual/get-started.html
I hope it will help you

Is there a way to get message by correlation Id without use any of the point to point sampler?

I am able to use two JSR223 samplers one for produce and one for consume without any issue (no JNDI setup).
Now, I would like to know is there a way to validate the received message content filter by correlation Id?
For example, my sampler 1 produced 100 msg with 100 different correlationId, then how my second sampler can get the correlation Id from the 1 sampler and validate the content?
You can use message.getJMSCorrelationID() function in first sampler in conjunction with vars.put() in order to retrieve the correlationID from the message and store it into JMeter Variables
vars.put('correlationId', message.getJMSCorrelationID())
and in 2nd sampler use vars.get() to retrieve the value in 2nd sampler
def correlationId = vars.get('correlationId')
Check out IBM MQ testing with JMeter - Learn How article for an example implementation of MQ load testing using JSR223 Test Elements and Groovy language

JMeter throughput value in grafana

I refer to the "http://www.testautomationguru.com/jmeter-real-time-results-influxdb-grafana/" article,
through grafana + infludx but there is a jmeter tps (throughput) value I do not know how get?
I tried "jmeter.all.h.count" but it did not seem to be the value I wanted:
I wrote the blog you were referring to!
We can not expect the backend listener metrics to give you an accurate result as you expect in the aggregate report - (specially percentiles, avg etc)
BackEndListener basically gives the metrics over time. You should plot the graph using the data over time. If you try to use single stat metric of Grafana with that data , then you will see a complete mismatch.
In the blog - I was using the modified apache_core.jar library to get the results as you are actually expecting. However I stopped sharing (after jmeter 2.13, jmeter 3.0) the modified lib.
You are referring to wrong component for values.
For GraphiteBackendListenerClient, sent values are described here:
http://jmeter.apache.org/usermanual/realtime-results.html
For InfluxdbBackendListenerClient, sent values can be found here:
https://github.com/apache/jmeter/blob/trunk/src/components/org/apache/jmeter/visualizers/backend/influxdb/InfluxdbBackendListenerClient.java
Both components don't send throughput as it can be computed using Grafana and other metrics.
Found your answer in influxdb grafana tutorial,
Use jmeter.all.a.count:
If I query the “jmeter.all.a.count” which has the no of requests processed for every second by the server, I get below output. [No of requests processed / unit time = Throughput]

How to use Random Variables in JMS Selector with JMeter JMS Subscriber

Has any one succeeded in using JMeter Random variable in JMS Selector with JMeter JMS Subscriber for ActiveMQ.
So far I tried to use like below for Random variables but no luck.
JMSCorrelationID ='${msgCorrelation_ID}'
Above selector is working if msgCorrelation_ID is defined as UDV but I need to use Random values per threads.
How do you set your msgCorrelation_ID? What value does Debug Sampler report?
As a solution I can suggest straightforward way of explicit generation of msgCorrelation_ID variable.
Add a Beanshell Pre Processor to your request configured as follows:
Parameters: ${__RandomString(10,abcdefghijklmnopqrstuvwxyz0123456789,)}
Script: vars.put("msgCorrelation_ID", Parameters);
This will populate msgCorrelation_ID variable with random alphanumeric string of 10 characters. You will be able to refer to it where required as ${msgCorrelation_ID} or ${__V(msgCorrelation_ID)}
References:
__randomString() function documentation
How to use BeanShell: JMeter's favorite built-in component guide on Beanshell scripting for Apache JMeter
This is because UDV are initialized at test plan startup. Since you have created your variable in Processor, you need to check Setup: Each sample on JMS Subscriber screen, so connection is initialized after ${msgCorrelation_ID} initialization.

Resources