Friday, September 18, 2015

How to set up Distributed testing with JMeter



For the JMeter distributed testing, it has two parts:

Masterthe system running JMeter GUI, which controls the test
Slavethe system running JMeter-server, which takes commands from the GUI and send requests to the target system(s)

Master machine also called Client machine, Slave machine also called Server machine.We need to setup both Master and Slave machines to make them work for the distributed testing.


Pre_request:

  1.  Installl JMeter with the same version in all of the test machines, master and slave machines. 
  2. Don't forget install the JMeterPlugins in all of the test machines(master and slave), this is very important for your test plan with Stepping Thread Group or Ultimate Group
  3. If your test plane need to using mysql DB, you should need to install mysql-connector-java-5.1.18-bin.jar too.   
 Setup Slave Machines:
  1. Modify the server_port to some value that is not be used, like this:                                                                                                                                                                                                  

                 
  2. Modify the server.rmi.localport to some value that is not be used. Like this:         
                                       
  3. Save the modifications
  4. Now Open jmeter-server.bat in all of the slave machines. Looks like this                                               
  5. Now catch all of the slave machines'  IP address, such as 10.223.141.25.


Setup Master Machine:
  1. Open jmeter.properties file in a text editor. This file is located in Jmeter \bin folder, C:\apps\apache-jmeter-2.13\bin\jmeter.properties
  2. Edit the line “remote_hosts=127.0.0.1” add the IP address. For example, if I have jmeter server running on 10.223.141.25, 26, 27 and 28, the entry would like like this:
    remote_hosts=10.223.141.25:55501, 10.223.141.26:55501, 10.223.141.27:55501, 10.223.141.28: 55501    

                                                                                                                                       
  3. Please notice, at here 55501 should be the same as the server_port value that you just modified in the slave machines. this is the channel for master machine to talk with slave machines. 
  4. After save the modification, open jmeter.bat in the Client machine. The JMeter GUI is opened. 
  5. Create a new test plan or open an existing test plan in the GUI, and from the Run Tab, you can invoke remote Start or remote Start All to trigger some specific slave machine or all of the slave machines to run your test plane.


Thursday, September 17, 2015

How to view the .jtl file from excel



Want to open the .jtl file  in the MS excel.  We need to do:


  •     Open the .jtl file from a wordpad or notepad 






  •    Insert the following line:

<?xml-stylesheet type="text/xsl" href="C:\apps\apache-jmeter-2.12\extras\jmeter-results-report_21.xsl"?>

This line is giving the location of  the style sheet file, it is located in the installed JMeter  extras folder. And it should be put in here:

<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet type="text/xsl" href="C:\apps\apache-jmeter-2.12\extras\jmeter-results-report_21.xsl"?>
<testResults version="1.2">







  • Save the .jtl file after insert xml line 
  • Open the MS Excel worksheet, and drag and drop this .jtl file into it.   

In the excel file the column title are such as "by","dt", "lb" etc. What do they mean? the following list is the meaning of them:

AttributeContent
byBytes
deData encoding
dtData type
ecError count (0 or 1, unless multiple samples are aggregated)
hnHostname where the sample was generated
itIdle Time = time not spent sampling (milliseconds) (generally 0)
lbLabel
ltLatency = time to initial response (milliseconds) - not all samplers support this
ctConnect Time = time to establish the connection (milliseconds) - not all samplers support this
naNumber of active threads for all thread groups
ngNumber of active threads in this group
rcResponse Code (e.g. 200)
rmResponse Message (e.g. OK)
sSuccess flag (true/false)
scSample count (1, unless multiple samples are aggregated)
tElapsed time (milliseconds)
tnThread Name
tstimeStamp (milliseconds since midnight Jan 1, 1970 UTC)
varnameValue of the named variable (versions of JMeter after 2.3.1)



 





 


How to run JMeter with NON-GUI



  • Go to JMeter  bin folder of your Jemeter installation from command prompt : such as this,

                                             C:\apps\apache-jmeter-2.12\bin>

  • type the following command
C:\apps\apache-jmeter-2.12\bin>jmeter.bat -n -t C:\JMeterTests\loadTest_1.jmx  -l C:\JMeterTests\exercise\Test2.jtl -D jmeter.save.saveservice.output_format=xml





·         jmeter.bat          invoke JMeter
·         -n                            means run JMeter in non GUI mode
·         -t                             means the location and name of the test script .jmx file
·         -l                             means the location of the log file and the results will be logged at this file. And this log result file has to be saved in  .jtl format.
·         -D                           means the format of the result log .jtl file  (if you want to open in Jemeter Graph, such as Response Time Graph, you need to set the format = xml, if you just want to open in in Summary report, xml format is not necessary, so this option can be ignored)


 
  • After invoke and run .jmx script file, waiting for the running is end.