Performance

1) How to handle sessions in Jmeter?

Add->Pre-Processors->HTTP URL Re-writting Modifier for the sampler where your session variable is present
Then add your variable in session argument name and check chache session id.
Please see the Image below:

Jmeter_SessionHandling

2) How to customize the user data/ how to run the script for multiple users in Jmeter?

i) Add Thread Group->Config Element-> CSV Data config Element
ii) Give user variables for the csv file column.
iii) Place the csv in the same folder where you kept the jmeter script or give full file path in filename

See the images below:

Jmeter_CSV1

 

 

 

 

 

 

Jmeter_CSV

 

 

 

 

 

 

 

 

3) How to run the Jmeter for more than 300 users?

i) Run in Non GUI distributed mode to run for more than 300 users. It depends on RAM size. For the system with 3.2 GB, you can run up-to 1000 users.

Step1:
Configure Jmeter for Distributed testing

Step2:
Place your script and csv in /bin folder of the jmeter.

Step3:
Open command prompt , go to jmeter bin directory and give the following command

jmeter -n -t testplan.jmx -R ip1,ip2 -l resultfilename

4) How to record Jmeter script?
you can capture headers and parameters of the request by Fiddler or HTTPWATCH and write the script manually, or configure proxy and use Recording controller.

Detailed manual is available in Apache Site:
http://jmeter.apache.org/usermanual/jmeter_proxy_step_by_step.pdf

5) How to extract the data using regex in Jmeter?

There is an element called preprocessor->regularexpression.

Add it under the request you want and then follow the below steps:

i) Give reference name (any name , that will be substituted in the place of actual parameter value in the request)

ii) Give the regular expression , for example if the text to be extracted is ‘world’ from text=’world’, then the regex will be like this text='(.+?)’

iii) Give template as $1$

iv) Match No would be which row of the value from the web page , it may be 1, 2,3 etc. If you want random row then give ‘0’

v)Default value is a string that will be sent to the server when it fails to extract the data. it can be anything for Ex: Loginid_Failed

Please see the Image below:

Jmeter_Regex

 

 

 

 

 

 

6) what are the charcters used in regex?

Regular Expressions use certain characters and those have special meaning. Following are the list of such characters.
( ) : grouping
[ ] : character classes
{ } : repetition
* + ? : repetition
. : wild-card character
: escape character
| : alternatives
^ $ : start and end of string or line

7) How can i use special charcters with actual meaning in regex?

Add backslash to the special character to mean it as it is, for example (),$,^.

8)  Mention example for regular expression to extract string with whitespace

Regular Expression : <url.values+(.+?)=”(.+?)”

Explanation:

<url.value    : Extract the string <url.value

<url.values  : Extract the string <url.value followed by white space

<url.values+Extract the string <url.value followed by white space and

<url.values+(.+?) : Extract the string <url.value followed by white space and any character with 1 or more match

<url.values+(.+?) =  : Extract the string <url.value followed by white space and any character with 1 or more match with equals symbol 

<url.values+(.+?) =”(.+?)” : Extract the string <url.value followed by white space and any character with 1 or more match with equals symbol  and any charcter with 1 or more matches inside double quotes.

So the final string returned from above condition may be like this:

<url.value groupid=”1234trurbd93737″

9) How to use java program inside Jmeter?

Java program can be called inside jmeter by using BeanShell Pre/Post Processor.

10) How to send file with Jmeter script?

There is a column in http request as ‘ Send Files with the Request’

Give the filepath,parameter name and MIME type.

For sending different files , give it in CSV file and add the variable in CSVconfig Element. (Any question related this, you can post your questions)

11) How to capture Jmeter results?

There are lot of graphs/listeners available for jmeter. Or if the purpose is to find response time for the request, use ‘Aggregate Report’ and take min, max, avg timings(in milliseconds) . That will help a lot.
Or you can download plugin for colorful graphs.

http://code.google.com/p/jmeter-plugins/

Jmeter_AggregateReport

12) How to View the results of JTL file created in NON-GUI mode?
Open any Jmeter script, go to Aggregate report listener, Browse the file and Open it. After that you can Save it as CSV file.

13) How to test ‘HTTPS’ applications using Jmeter?
In HTTP Request default, mention the protocol as ‘https

14) How to rectify Jmeter out of memory error-heap space when opening Jmeter?
Right Click and Edit Jmeter.bat file , increase Xmx value and check.

15) Where to Download Jmeter latest version?
https://jmeter.apache.org/download_jmeter.cgi

16) How to execute ssh command or shell script on remote server using Jmeter?
Using SSH sampler it can be done. For detailed explanation see here
https://www.technix.in/execute-linux-command-shell-script-apache-jmeter/

17) How to run endurance test using Jmeter for more than 8 hours?

Using Timers , it is possible to run endurance test using jmeter, please look at this

https://www.technix.in/run-overnight-endurance-test-consecutively-using-jmeter/