JMeter JDBC Sampler extract more than one column values - jmeter

I have a sql like the following in JDBC Sampler of JMeter
select id,code from table where .....
how do I extract the value of the two columns.

Are you asking how to extract a value from the response?
If so, use the post-processor "regular expression extractor", attached to the JDBC request.

If you want to extract all data, you can use he post processor "Save Response to a file".
http://jmeter.apache.org/usermanual/component_reference.html#Save_Responses_to_a_file
What is good is that the output for each request is extracted to a separate file, very useful if you use the CSV data config with your request. You just specify the prefix for files.
The output will look like :
result_save_1.plain
result_save_11.plain
result_save_13.plain
result_save_15.plain
result_save_17.plain
ETC...
The Variable Name is very useful because it describe how you can reintegrate thoses files in JMeter using the variable name.
JMeter is a killer app!

Related

Jmeter - Need to check empty tags in SOAP request

I have a SOAP request. I need to use jmeter to test multiple requests for same method, each time passing one missing element.
How can I achieve this ?
I tried writing the tags into csv using CSV data config , but I am unable to enter empty values in the csv, each time for a different tag in each csv row.
Any help would be appreciated. Thank you.
The CSV Data Set Config will read the value from next line only on the next iteration of the thread (virtual user), you cannot read more than one line within the bounds of a single iteration. You might want to take a look at __CSVRead() function where it's you who decides when to proceed to the next line.
If the __CSVRead() function isn't applicable for your use case be aware that you can build a request body, i.e. XML from CSV file using JSR223 PreProcessor and Groovy language.
See Creating XML chapter of Groovy documentation for more details.

Jmeter can get parameters?

My question is - if I run a test via Jmeter, for example , if it's a site which enables you to book a flight, and you choose your source and destination when you record it.
Is it possible to pass different values to the destination field? I mean, maybe a txt file with some destinations and pass it to the Jmeter test and then, you will have some tests which each of them is running with a different destination?
If yes, how can I do it?
It's not necessary that it will be a txt file. Just a way to pass different values to one parameter.
Important: I'm using blazemeter plugin for chrome.
Thanks a lot,
appreciated.
You can use CSV Data Set Config. It is very easy to use for parameterizing variables in the test plan.
Check this article on blazemeter to understand the CSV Data Set Config quickly.
Depending on what you're trying to achieve you can go for:
HTML Link Parser. See Poll Example which shows how you can use it for selecting random values from inputs
You can extract all the possible values from the previous response using a Post-Processor, most probably CSS Selector Extractor and configure each thread to use its own (or random) value from the input
And last, but not the least, you can use an external data source like .txt or .csv file and utilize __StringFromFile() function or CSV Data Set Config so each thread (virtual user) would read the next value from file instead of using recorded hard-coded values.

How to hit parameterized url in Apache Jmeter?

This is my test URL " http://appr.seconddemo.org/hitssurveys/survey?uid=113&offerid=311&subid=subvalues&offr_id={Email} "
I want to hit the url 1500 times per second , and want to change the "{Email}" with real value in each iteration.
How it's possible please give me a step by step guide.
Considering that you need to pass the emails from the external file, the most efficient way that we are using in software testing companies is to pass the variable from .csv or .txt files using 'CSV Data Set Config' element of the JMeter.
Please find the steps that you need to follow:
Add a 'CSV Data Set Config' element from 'Config Element' by right-clicking the thread group
Set Filename field with complete path to your .csv or .txt file that contains your emails
Set Variable field as 'Email' [This variable name should be same as you set in your url request]
Ignore first line to False
Set other fields as per your requirement
Now add HTTP Sampler in your Thread Group and set the Protocol, Server Name, Method & Path as instructed in the screenshot:
Create .csv or .txt file and add all emails separated by new line:
Hope this answer is useful.
You can use the CSV Data Set Config. Put all your email credentials in the CSV file and make sure you have put this CSV file in your JMeter /bin directory.
Add a CSV dataset config in your test plan. Your CSV dataset config should be like:
Now in your thread group, define the number of threads you want to execute and then in your sampler put the path as follows:
http://appr.seconddemo.org/hitssurveys/survey?uid=113&offerid=311&subid=subvalues&offr_id=${Email}
Depending on where do your emails live there are following options:
If they are in a text file, each email on a new line you can use __StringFromFile() function like:
If they are in a database you can use JDBC PreProcessor to fetch the data from the database table column and put your request under ForEach Controller
If you need to provide just some random characters you can use __RandomString() function.
More information: JMeter Parameterization - The Complete Guide

HTTP Request path needs to be parameterized with UUID and a random URL

URL format is
www.something.com/something/api/{uuid}?code=gomundw0gjq2kbvc3g63whfr9usap5rurjaq5vui5vm6xbt9hhqa8hbcpto4yatwpn26v42t9
I need to make several calls to this GET Url and check performance of the feature.
uuid here is not just the UUID , but is specific to my application
UUID= accountid+identifierid+uuid, which will look like 1234+1234+123e4567e89b12d3a456426655440000
How should I arrange my Jmeter Test Plan.
My Plan would be:
write UUID generated to a file
Using any preprocessor call the file from file and write program to append to a different value in the csv which is account/identifierid.
Please help on this, can some one explain how I should logically arrange my test plan and code to get data to parameterize my path in HTTP Request sampler.
Thanks in Advance
You need to get accountid+identifierid information stored into CSV file. This is something you need to do on your own.
You can use CSV Data Set Config in order to get the information from that file while your test is running, example configuration would be:
UUID can be generated using __UUID() function
So your HTTP Request sampler configuration would be something like:

Automatically generate HTTP request URLs in JMeter

I have an API call URL similar to this:
http://domain.com/rest/getValues?apiKey=sdfsdf&customerId=2200&timestampBegin=2013-08-15%2018:00:00%20CEST&timestampEnd=2013-08-19%2018:00:00%20CEST
I would like to dynamically change the time stamps, as well as the customerId, picked from a given set of timestamps and customerIds. Is this possible to do in Jmeter (preferably through GUI)?
Assuming that you are have inputs coming from external CSV file, you can use CSV data set config as explained here.
Your test plan will look something like
Thread groups
CSV Data Set config (define the file path and the variable names. You will be able to read these variables in request.
HTTP Sampler
http://domain.com/rest/getValues?apiKey=sdfsdf&customerId=${custid}&timestampBegin=${begin}&timestampEnd=${end}

Resources