jmeter
what is Jmeter
- Performance test application
- Build using java
- Free & Open Source
- Recording
- CLI
- Reports
install Jmeter
- check java is installed on your system
java -version
on cmd
- download Jmeter and unzip
- start Jmeter
- Windows -> jmeter/bin -> jmeter.bat
- Mac -> open terminal -> jmeter/bin -> sh jmeter.sh
create first Jmeter test
- Start Jmeter
- Create a TestPlan
- Create a Thread Group(Users)
- Add a Sampler(Http)
- Add Listeners
- Run the Test
Jmeter Listeners(Reporting)
- used for reporting
- listener = elements that gather information about the performance test used to view results/metrics of the test
- 1000 ms = 1 sec
- View Results in Table
- Latency: start get response - finished response
- View Result Tree
- Aggregate Report
- Graph Results
- Summary Report
- Simple Data Writer
Assertions
- Assertions = check on the Request/Response
- Response Assertion
- Duration Assertion
- Size Assertion
- HTML Assertion
- XML JSON Assertion
- XPATH Assertion
Jmeter HTTP(s) Test Script Recorder
- what
- why
- when
- how
- how to record your test on Jmeter?
- how to add & use Test Script Recorder?
- how to add & use Recording Controller?
- how to use proxy on Firefox,Chrome and System?
- how to add SSL Certificate?
- how to do Request Filter?
- how to use Recording Template?
How to use Blazemeter to Record JMeter Tests
- create Blazemeter account
- get blazemeter extension
- login to Blazemeter
- record test
- save JMX
- Add JMX in JMeter and Run
How to get data from csv file
- Add - Config Element - CSV Data Set Config
- create csv file and add data
- refer csv file in JMeter’s csv data set config
- refer values from csv file using syntax ${variableName}
JMeter Config Elements - for HTTP (Web Test Plan)
- Elements that are executed before the sampler requests at the same level
- Configuration elements can be used to set up defaults and variables for later use by samplers. Note that these elements are processed at the start of the scope in which they are found, i.e. before any samplers in the same scope
- Demo app - https://opensource-demo.orangehrmlive.com/
How to run JMeter from command line
- GUI consumes memoryy,slower
- integrate with any external process CI CD
- How to run JMeter from command line?
- How to log results?
- goto jemeterbin folder
- windows:
jmeter -n -t "location of your test" -l "location of your result"
- mac/linux:
sh jmeter -n -t "location of your test" -l "location of your result"
- How ti see command line help and options?
jmeter -h
jemter.bat -?
- How to run fomr any location on your system?
- add in Path env variables
Hor to create HTML Reports from command line & GUI
- How to create html dashboard reports from command line
- How to create html dashboard reports from standard csv result file
- Study the html dashboard reports
- create a test plan or use existing test plan
- open command line goto jmeter bin folder
- generate report from run test plan
jmeter -n -t "C:\Workspace\learn-automation\6-Jmeter\Test Plan - html report.jmx" -l "C:\Workspace\learn-automation\6-Jmeter\result-log.csv" -e -o "C:\Workspace\learn-automation\6-Jmeter\Reports"
- generate report from csv result
jmeter -g "C:\Workspace\learn-automation\6-Jmeter\result-log.csv" -o "C:\Workspace\learn-automation\6-Jmeter\Reports"
- How to generate from GUI?
- Tools - Generate html report
How to extend JMeter | JMeter plugins manager
Plugins - https://jmeter-plugins.org/
- find plugins
- download plugins manager jar form https://jmeter-plugins.org/wiki/PluginsManager/
- install
- add jat to jmeter/lib/ext
- restart jmeter
- Options - JMeter Plugins Manager
- uninstal
- upgrade
How to create TEST API Request in JMter
- GET,POST,PUT,DELETE
- HTTP Request
- REST demo:https://reqres.in/
How to create a SOAP API Request
- How to add Request Sampler
- How to add Headers
- How to add Authorsation
- How to add Body
- How to add Assertions
- How to run and check results
- SOAP demo:http://www.dneonline.com/calculator.asmx?WSDL
- HTTP Request
- Body(XML)
- Header(Content-Type, SOAPACTION)
- Response Assertion
- Assertion Result
Functions & Veriables
- What are functions?
- methods used to populate fields in any other element of a test plan
- Syntax:
${__funcName}
${__funcName(var1,var2,...)}
- What are variables?
- contains that can store values which can be referred in any element within a thread
- Syntax:
${varName}
- How to use functions and variables?