SlideShare ist ein Scribd-Unternehmen logo
1 von 40
Introduction to JMeter
By Ranil Weerasinghe
&
Tharinda Liyanage
What will be covered…
• 1st Phase
• Getting to know about the tool
• Types of Applications/protocols
• Features
• Installation and configuration
• Components
• Strengths and Weaknesses
• 2nd phase
• Practical session with examples
What is JMeter
• Performance testing tool (like LoadRunner, WebLoad, OpenSTA , etc)
• It supports performance testing of:
• Web application
• Web services (SOAP and REST)
• Database query performance
• Mail - SMTP(S), POP3(S) and IMAP(S)
• JMS
• Mobile
• Apache Project - http://jmeter.apache.org/
• 100% pure Java desktop application
• Originally developed by Stefano Mazzocchi
Features of JMeter
• Load and performance test various protocols
- HTTP(S), FTP, JDBC, JMS, LDAP, SOAP
•HTTP proxy server for recording test scripts – eliminates 3rd party recording tools like
“Badboy”
•Platform Independent
•Execution can do in batch mode and analyze offline.
•Distributed testing.
•Extensible. – Plugins (https://code.google.com/p/jmeter-plugins/)
Test Architecture
Strengths
• Free and open source
• Active development/ community
• Extensibility
• Capability of dynamic scripting/ generate load/ and reporting
• Supports automation (Maven with Jenkins CI for performance testing in regression
mode)
• Cloud compatibility
Weaknesses
• Memory management issues
But …adjust Heap memory/ use 64-bit version/ run non-GUI mode
• Reports are a bit lacking
But... Plugins provides many
• Steep learning curve
Lack of Training opportunities and require technical skills
• Limited Support
No dedicated support like commercial tools
Setting Up and Running JMeter
• The latest version of JMeter can be downloaded from the project website:
http://jmeter.apache.org/download_jmeter.cgi
• JMeter requires a fully compliant JVM 1.6 or higher.
 You need Java, with the JAVA_HOME environment variable set.
• To install a release build, simply unzip the zip/tar file into the directory where you
want JMeter to be installed.
• To run JMeter, run the jmeter.bat (for Windows)
• or jmeter.sh (for Unix) file.
JMeter Elements
• Test Plan: where the overall settings for a test are specified.
• Thread groups: defines a pool of users that will execute a particular test case
against your server.
• Samplers: sends requests to a server
• Logical controllers : control flow of test plan (loops, conditionals, ordering, etc.)
• Listeners: record, summarize and display record and response data
• Timers: introduce delays in test plan
• Assertions: assert facts about responses, for functional testing
• Configuration elements: Configuration Elements set default values for other parts
of the Test Plan as well as configure variables.
• Pre-processors and post-processors
• Workbench :It provides a place to temporarily store test elements while
not in use for copy/paste purposes
• JMeter Proxy Server : watch and record your actions while you browse your web
application with your normal browser
Test plan
• Where the overall settings for a test are specified.
Thread group
• Thread group elements are the beginning points of any test plan.
• It controls the number of threads JMeter will use to execute your test
Samplers
• Samplers tell JMeter to send requests to a server and wait for a response.
• Processed in the order they appear in the tree.
• Controllers can be used to modify the number of repetitions of a sampler.
•HTTP Request
• JDBC Request
• Java object request
• LDAP Request
• SOAP/XML-RPC Request
•FTP Request
Logical controllers
• Loop Controller
• If controller
• Transaction Controller
• Recording Controller
Logic Controllers determine the order in which Samplers are processed
Some controller are:
Listeners
• “Listen" to the test results.
• View, save, and read saved test results
• Can be saved to JTL, CSV or XML format.
• Listeners can be added anywhere in the test, including directly under the
test plan.
Listeners
Timers
• Add delay to script
• If not, overwhelms your server
• Ex:
• Constant timer
• Random timer
• Synchronizing timer
Assertions
• Verify correctness of your response.
• Ex:
• Response assertion – Verify fields of response
• Size assertion - tests that each response contains the right
number of bytes in it
• Duration assertion- tests response received within a given
amount of time
Functions & Variables
• Variables – to parameterized
•JMeter variables are local to each thread.
•Referenced as ${VARIABLE}
•Functions
•Are special values that can populate fields of any Sampler or other
element in a test tree
${__FunctionName()}
• Types
•Information
•Ex: ${__log()}
•Input
•Ex: ${__StringFromFile()}
•Calculations
•Ex: ${__RandomString()}
Demo
1. Adding a Thread Group
Test Plan -> Thread Group
– Number of thread
– Ramp-up Period
– Loop count
2. Adding a HTTP Request Defaults
Test Plan -> Thread Group -> HTTP Request Defaults (HTTP Request Defaults saves you time when
doing lots of HTTP Samplers)
– Protocol – enter “HTTP”
– Server name – enter “jakarta.apache.org”
– Path – leave blank
– Port number – enter “80”
How to Build a Test Plan
How to Build a Test Plan Cont..
3. Adding a HTTP Proxy Server
Workbench -> HTTP Proxy Server
– Port field - Enter “9090”
– Target Controller – click on the drop down and select “test plan > thread group”
– Click the “add” button in “Patterns to include”.
– This will create a blank entry. Enter “.*.html”
– Click the “add” button in “Patterns to exclude”.
– This will create a blank entry. Enter “.*.gif”
– Click the “start” button at the bottom
4. Setting a Proxy in IE
– Start Internet Explorer, but do not close Jmeter.
– From the tool bar, click “tools -> internet options”.
– Select the “connection” tab
– Click “LAN settings” button
– On the connections tab, check “Use a proxy server for
your LAN”.
How to Build a Test Plan Cont..
– Address – enter “Localhost” or the IP address of your system
– Port – enter “9090”.
– Click “ok” button
– Click “ok” button again. This should return you to the browser
– In the “Address” bar at the top, enter
“http://jakarta.apache.org/jmeter/index.html” and hit the “enter” key.
– Click on a few links on Jmeter's page.
– Close internet explorer and bring up the JMeter window.
5. Adding a Listeners
Test Plan -> Thread Group -> Listeners
– Graph Results
– View Results in table
– View Results in tree
– Aggregate report
How to Build a Test Plan Cont..
6. Adding a Cookie Manager
Test Plan -> Thread Group -> HTTP Cookie Manager
Many Web applications use cookies. JMeter provides cookie capabilities through a
Cookie Manager. Adding this element to a thread group allows you to send cookies to
the application being tested, just as Web browsers do.
Creating a Load Test Scenario and Execution
JMeter Performance Test Results- View
Results Tree
JMeter Performance Test Results- Summary
Report
Assertions
• Assertions allow you to assert facts about responses received from the server being
tested. Using an assertion, you can essentially "test" that your application is returning
the results you expect it to.
Parameterization – User Define Variables
• Thread Group -> Config Element -> User Define Variables
Parameterization – CSV Data Set Config
• Thread Group -> Config Element -> CSV Data Set Config
Parameterization – CSV Data Set Config
Session Handling
Session Handling Cont..
Session Handling Cont..
• Thread Group -> Post-Processors -> Regular Expression Extractor
Session Handling Cont..
Regular Expressions
* - Matches 0 or more time
+ - Matches 1 or more time
.(dot) – match any character
? – stop when first match succeeds
( and ) – these enclose the portion of the
match string to be returned
More Regular Expressions
http://jakarta.apache.org/oro/api/org/
apache/oro/text/regex/package-
summary.html
Session Handling Cont..
Session Handling Cont..
JMeter Best Practices
 Use non-GUI mode: jmeter -n -t test.jmx -l test.jtl
 Use as few Listeners as possible; if using the -l flag as above they can all be
deleted or disabled.
 Don't use "View Results Tree" or "View Results in Table" listeners during the
load test, use them only during scripting phase to debug your scripts.
 Rather than using lots of similar samplers, use the same sampler in a loop,
and use variables (CSV Data Set) to vary the sample. Or perhaps use the
Access Log Sampler. [The Include Controller does not help here, as it adds
all the test elements in the file to the test plan.]
JMeter Best Practices Cont..
 Don't use functional mode
 Use CSV output rather than XML
 Only save the data that you need
 Use as few Assertions as possible
JMeter Distributed Testing
- Pre conditions
• The firewalls on the systems are turned off.
• All the clients are on the same subnet.
• The server is in the same subnet, if 192.x.x.x or 10.x.x.x ip addresses are used. If the
server
doesn't use 192 or 10 ip address, there shouldn't be any problems.
• Make sure jmeter can access the server.
• Make sure you use the same version of Jmeter on all the systems. Mixing versions may
not work correctly.
• Following image Illustrate the way, how the JMeter Master / Slave configuration works
"Introduction to JMeter" @ CPTM 3rd Session

Weitere ähnliche Inhalte

Was ist angesagt?

Was ist angesagt? (20)

Perfromane Test Tool jmeter
Perfromane Test Tool jmeterPerfromane Test Tool jmeter
Perfromane Test Tool jmeter
 
Introduction to jmeter & how to view jmeter Test Result in Real-Time
Introduction to jmeter & how to view jmeter Test Result in Real-TimeIntroduction to jmeter & how to view jmeter Test Result in Real-Time
Introduction to jmeter & how to view jmeter Test Result in Real-Time
 
Jmeter From Scratch
Jmeter From ScratchJmeter From Scratch
Jmeter From Scratch
 
Performance Testing using Jmeter and Capacity Testing
Performance Testing using Jmeter and Capacity TestingPerformance Testing using Jmeter and Capacity Testing
Performance Testing using Jmeter and Capacity Testing
 
Performance testing with jmeter
Performance testing with jmeter Performance testing with jmeter
Performance testing with jmeter
 
Jmeter
JmeterJmeter
Jmeter
 
JMeter workshop
JMeter workshopJMeter workshop
JMeter workshop
 
JMeter Post-Processors
JMeter Post-ProcessorsJMeter Post-Processors
JMeter Post-Processors
 
Load Testing with JMeter
Load Testing with JMeterLoad Testing with JMeter
Load Testing with JMeter
 
Basic of jMeter
Basic of jMeter Basic of jMeter
Basic of jMeter
 
Jmeter introduction
Jmeter introductionJmeter introduction
Jmeter introduction
 
J Meter Intro
J Meter IntroJ Meter Intro
J Meter Intro
 
Load Test Drupal Site Using JMeter and Amazon AWS
Load Test Drupal Site Using JMeter and Amazon AWSLoad Test Drupal Site Using JMeter and Amazon AWS
Load Test Drupal Site Using JMeter and Amazon AWS
 
Performance Testing With Jmeter
Performance Testing With JmeterPerformance Testing With Jmeter
Performance Testing With Jmeter
 
Performance testing using jmeter
Performance testing using jmeterPerformance testing using jmeter
Performance testing using jmeter
 
Performance testing and_reporting_with_j_meter by Le Van Nghi
Performance testing and_reporting_with_j_meter by  Le Van NghiPerformance testing and_reporting_with_j_meter by  Le Van Nghi
Performance testing and_reporting_with_j_meter by Le Van Nghi
 
Perofrmance testing and apache jmeter
Perofrmance testing and apache jmeterPerofrmance testing and apache jmeter
Perofrmance testing and apache jmeter
 
Introduction to JMeter
Introduction to JMeterIntroduction to JMeter
Introduction to JMeter
 
Using JMeter and Google Analytics for Software Performance Testing
Using JMeter and Google Analytics for Software Performance TestingUsing JMeter and Google Analytics for Software Performance Testing
Using JMeter and Google Analytics for Software Performance Testing
 
Performance testing with JMeter
Performance testing with JMeterPerformance testing with JMeter
Performance testing with JMeter
 

Andere mochten auch

Introduction to JMeter
Introduction to JMeterIntroduction to JMeter
Introduction to JMeter
Rahul Sudame
 
How to Analyze Reports in Jmeter
How to Analyze Reports in JmeterHow to Analyze Reports in Jmeter
How to Analyze Reports in Jmeter
Viviana Lesmes
 
Performance testing jmeter
Performance testing jmeterPerformance testing jmeter
Performance testing jmeter
Bhojan Rajan
 
Jmeter Performance Testing
Jmeter Performance TestingJmeter Performance Testing
Jmeter Performance Testing
Atul Pant
 
BlazeMeter Presents at the High Performance Drupal Meetup
BlazeMeter Presents at the High Performance Drupal MeetupBlazeMeter Presents at the High Performance Drupal Meetup
BlazeMeter Presents at the High Performance Drupal Meetup
BlazeMeter
 
Apachejmeterabriefintroduction
ApachejmeterabriefintroductionApachejmeterabriefintroduction
Apachejmeterabriefintroduction
Foredoomed
 
Apache JMeter Introduction
Apache JMeter IntroductionApache JMeter Introduction
Apache JMeter Introduction
Søren Lund
 
Automated Performance Testing With J Meter And Maven
Automated  Performance  Testing With  J Meter And  MavenAutomated  Performance  Testing With  J Meter And  Maven
Automated Performance Testing With J Meter And Maven
PerconaPerformance
 

Andere mochten auch (16)

Introduction to Jmeter
Introduction to JmeterIntroduction to Jmeter
Introduction to Jmeter
 
Introduction to JMeter
Introduction to JMeterIntroduction to JMeter
Introduction to JMeter
 
How to Analyze Reports in Jmeter
How to Analyze Reports in JmeterHow to Analyze Reports in Jmeter
How to Analyze Reports in Jmeter
 
Performance testing jmeter
Performance testing jmeterPerformance testing jmeter
Performance testing jmeter
 
Jmeter Performance Testing
Jmeter Performance TestingJmeter Performance Testing
Jmeter Performance Testing
 
BlazeMeter Presents at the High Performance Drupal Meetup
BlazeMeter Presents at the High Performance Drupal MeetupBlazeMeter Presents at the High Performance Drupal Meetup
BlazeMeter Presents at the High Performance Drupal Meetup
 
Load testing jmeter
Load testing jmeterLoad testing jmeter
Load testing jmeter
 
Apachejmeterabriefintroduction
ApachejmeterabriefintroductionApachejmeterabriefintroduction
Apachejmeterabriefintroduction
 
Apache JMeter Introduction
Apache JMeter IntroductionApache JMeter Introduction
Apache JMeter Introduction
 
JMeter
JMeterJMeter
JMeter
 
Automated Performance Testing With J Meter And Maven
Automated  Performance  Testing With  J Meter And  MavenAutomated  Performance  Testing With  J Meter And  Maven
Automated Performance Testing With J Meter And Maven
 
Load testing with J meter
Load testing with J meterLoad testing with J meter
Load testing with J meter
 
Apache JMeter - A Brief Introduction
Apache JMeter - A Brief IntroductionApache JMeter - A Brief Introduction
Apache JMeter - A Brief Introduction
 
How to Run a 1,000,000 VU Load Test using Apache JMeter and BlazeMeter
How to Run a 1,000,000 VU Load Test using Apache JMeter and BlazeMeterHow to Run a 1,000,000 VU Load Test using Apache JMeter and BlazeMeter
How to Run a 1,000,000 VU Load Test using Apache JMeter and BlazeMeter
 
Apache JMeter - A brief introduction
Apache JMeter - A brief introductionApache JMeter - A brief introduction
Apache JMeter - A brief introduction
 
Silk Performer Presentation v1
Silk Performer Presentation v1Silk Performer Presentation v1
Silk Performer Presentation v1
 

Ähnlich wie "Introduction to JMeter" @ CPTM 3rd Session

Server Performance by Tonny
Server Performance by TonnyServer Performance by Tonny
Server Performance by Tonny
Agate Studio
 
Performancetestingjmeter 131210111657-phpapp02
Performancetestingjmeter 131210111657-phpapp02Performancetestingjmeter 131210111657-phpapp02
Performancetestingjmeter 131210111657-phpapp02
Nitish Bhardwaj
 
Soft Test Ireland - Introduction to Jakarta Jmeter - Philip Bannon
Soft Test Ireland - Introduction to Jakarta Jmeter - Philip BannonSoft Test Ireland - Introduction to Jakarta Jmeter - Philip Bannon
Soft Test Ireland - Introduction to Jakarta Jmeter - Philip Bannon
David O'Dowd
 
Jmeter_Presentaion_Parag
Jmeter_Presentaion_ParagJmeter_Presentaion_Parag
Jmeter_Presentaion_Parag
PARAG KHEDIKAR
 
performancetestingjmeter-121109061704-phpapp02
performancetestingjmeter-121109061704-phpapp02performancetestingjmeter-121109061704-phpapp02
performancetestingjmeter-121109061704-phpapp02
Gopi Raghavendra
 
performancetestingjmeter-121109061704-phpapp02 (1)
performancetestingjmeter-121109061704-phpapp02 (1)performancetestingjmeter-121109061704-phpapp02 (1)
performancetestingjmeter-121109061704-phpapp02 (1)
QA Programmer
 

Ähnlich wie "Introduction to JMeter" @ CPTM 3rd Session (20)

Performancetestingjmeter 121109061704-phpapp02
Performancetestingjmeter 121109061704-phpapp02Performancetestingjmeter 121109061704-phpapp02
Performancetestingjmeter 121109061704-phpapp02
 
Best Jmeter Interview Questions- Prepared by Working Professionals
Best Jmeter Interview Questions- Prepared by Working ProfessionalsBest Jmeter Interview Questions- Prepared by Working Professionals
Best Jmeter Interview Questions- Prepared by Working Professionals
 
Server Performance by Tonny
Server Performance by TonnyServer Performance by Tonny
Server Performance by Tonny
 
JMeter Intro
JMeter IntroJMeter Intro
JMeter Intro
 
Day1_Apache_JMeter_Overview
Day1_Apache_JMeter_OverviewDay1_Apache_JMeter_Overview
Day1_Apache_JMeter_Overview
 
Performancetestingjmeter 131210111657-phpapp02
Performancetestingjmeter 131210111657-phpapp02Performancetestingjmeter 131210111657-phpapp02
Performancetestingjmeter 131210111657-phpapp02
 
JMETER-SKILLWISE
JMETER-SKILLWISEJMETER-SKILLWISE
JMETER-SKILLWISE
 
Performance testing and j meter
Performance testing and j meterPerformance testing and j meter
Performance testing and j meter
 
Soft Test Ireland - Introduction to Jakarta Jmeter - Philip Bannon
Soft Test Ireland - Introduction to Jakarta Jmeter - Philip BannonSoft Test Ireland - Introduction to Jakarta Jmeter - Philip Bannon
Soft Test Ireland - Introduction to Jakarta Jmeter - Philip Bannon
 
Test talk academy apachejmeter-120521121306-phpapp02
Test talk academy apachejmeter-120521121306-phpapp02Test talk academy apachejmeter-120521121306-phpapp02
Test talk academy apachejmeter-120521121306-phpapp02
 
Testing - How Vital and How Easy to use
Testing - How Vital and How Easy to useTesting - How Vital and How Easy to use
Testing - How Vital and How Easy to use
 
J meter introduction
J meter introductionJ meter introduction
J meter introduction
 
Jmeter_Presentaion_Parag
Jmeter_Presentaion_ParagJmeter_Presentaion_Parag
Jmeter_Presentaion_Parag
 
JMeter & ColdFusion
JMeter & ColdFusion JMeter & ColdFusion
JMeter & ColdFusion
 
apache_jmeter.pptx
apache_jmeter.pptxapache_jmeter.pptx
apache_jmeter.pptx
 
Performance testing with Jmeter
Performance testing with JmeterPerformance testing with Jmeter
Performance testing with Jmeter
 
QA. Load Testing
QA. Load TestingQA. Load Testing
QA. Load Testing
 
JMeter.ppt
JMeter.pptJMeter.ppt
JMeter.ppt
 
performancetestingjmeter-121109061704-phpapp02
performancetestingjmeter-121109061704-phpapp02performancetestingjmeter-121109061704-phpapp02
performancetestingjmeter-121109061704-phpapp02
 
performancetestingjmeter-121109061704-phpapp02 (1)
performancetestingjmeter-121109061704-phpapp02 (1)performancetestingjmeter-121109061704-phpapp02 (1)
performancetestingjmeter-121109061704-phpapp02 (1)
 

Mehr von Tharinda Liyanage (8)

Testing strategy for agile projects updated
Testing strategy for agile projects updatedTesting strategy for agile projects updated
Testing strategy for agile projects updated
 
Qa and Testing
Qa and TestingQa and Testing
Qa and Testing
 
Useful JMeter functions for scripting
Useful JMeter functions for scriptingUseful JMeter functions for scripting
Useful JMeter functions for scripting
 
Introduction to Performance Testing
Introduction to Performance TestingIntroduction to Performance Testing
Introduction to Performance Testing
 
Formulating Agile Testing Strategy
Formulating Agile Testing StrategyFormulating Agile Testing Strategy
Formulating Agile Testing Strategy
 
Coded UI: Hand Coding based on Page Object Model
Coded UI: Hand Coding based on Page Object ModelCoded UI: Hand Coding based on Page Object Model
Coded UI: Hand Coding based on Page Object Model
 
PerfTest in SOA
PerfTest in SOAPerfTest in SOA
PerfTest in SOA
 
Introduction to performance testing
Introduction to performance testingIntroduction to performance testing
Introduction to performance testing
 

Kürzlich hochgeladen

BASLIQ CURRENT LOOKBOOK LOOKBOOK(1) (1).pdf
BASLIQ CURRENT LOOKBOOK  LOOKBOOK(1) (1).pdfBASLIQ CURRENT LOOKBOOK  LOOKBOOK(1) (1).pdf
BASLIQ CURRENT LOOKBOOK LOOKBOOK(1) (1).pdf
SoniaTolstoy
 
Ecosystem Interactions Class Discussion Presentation in Blue Green Lined Styl...
Ecosystem Interactions Class Discussion Presentation in Blue Green Lined Styl...Ecosystem Interactions Class Discussion Presentation in Blue Green Lined Styl...
Ecosystem Interactions Class Discussion Presentation in Blue Green Lined Styl...
fonyou31
 
1029-Danh muc Sach Giao Khoa khoi 6.pdf
1029-Danh muc Sach Giao Khoa khoi  6.pdf1029-Danh muc Sach Giao Khoa khoi  6.pdf
1029-Danh muc Sach Giao Khoa khoi 6.pdf
QucHHunhnh
 

Kürzlich hochgeladen (20)

Student login on Anyboli platform.helpin
Student login on Anyboli platform.helpinStudent login on Anyboli platform.helpin
Student login on Anyboli platform.helpin
 
Accessible design: Minimum effort, maximum impact
Accessible design: Minimum effort, maximum impactAccessible design: Minimum effort, maximum impact
Accessible design: Minimum effort, maximum impact
 
Arihant handbook biology for class 11 .pdf
Arihant handbook biology for class 11 .pdfArihant handbook biology for class 11 .pdf
Arihant handbook biology for class 11 .pdf
 
IGNOU MSCCFT and PGDCFT Exam Question Pattern: MCFT003 Counselling and Family...
IGNOU MSCCFT and PGDCFT Exam Question Pattern: MCFT003 Counselling and Family...IGNOU MSCCFT and PGDCFT Exam Question Pattern: MCFT003 Counselling and Family...
IGNOU MSCCFT and PGDCFT Exam Question Pattern: MCFT003 Counselling and Family...
 
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...
 
BASLIQ CURRENT LOOKBOOK LOOKBOOK(1) (1).pdf
BASLIQ CURRENT LOOKBOOK  LOOKBOOK(1) (1).pdfBASLIQ CURRENT LOOKBOOK  LOOKBOOK(1) (1).pdf
BASLIQ CURRENT LOOKBOOK LOOKBOOK(1) (1).pdf
 
Introduction to Nonprofit Accounting: The Basics
Introduction to Nonprofit Accounting: The BasicsIntroduction to Nonprofit Accounting: The Basics
Introduction to Nonprofit Accounting: The Basics
 
fourth grading exam for kindergarten in writing
fourth grading exam for kindergarten in writingfourth grading exam for kindergarten in writing
fourth grading exam for kindergarten in writing
 
Nutritional Needs Presentation - HLTH 104
Nutritional Needs Presentation - HLTH 104Nutritional Needs Presentation - HLTH 104
Nutritional Needs Presentation - HLTH 104
 
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptx
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptxSOCIAL AND HISTORICAL CONTEXT - LFTVD.pptx
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptx
 
Interactive Powerpoint_How to Master effective communication
Interactive Powerpoint_How to Master effective communicationInteractive Powerpoint_How to Master effective communication
Interactive Powerpoint_How to Master effective communication
 
Software Engineering Methodologies (overview)
Software Engineering Methodologies (overview)Software Engineering Methodologies (overview)
Software Engineering Methodologies (overview)
 
Ecosystem Interactions Class Discussion Presentation in Blue Green Lined Styl...
Ecosystem Interactions Class Discussion Presentation in Blue Green Lined Styl...Ecosystem Interactions Class Discussion Presentation in Blue Green Lined Styl...
Ecosystem Interactions Class Discussion Presentation in Blue Green Lined Styl...
 
1029-Danh muc Sach Giao Khoa khoi 6.pdf
1029-Danh muc Sach Giao Khoa khoi  6.pdf1029-Danh muc Sach Giao Khoa khoi  6.pdf
1029-Danh muc Sach Giao Khoa khoi 6.pdf
 
BAG TECHNIQUE Bag technique-a tool making use of public health bag through wh...
BAG TECHNIQUE Bag technique-a tool making use of public health bag through wh...BAG TECHNIQUE Bag technique-a tool making use of public health bag through wh...
BAG TECHNIQUE Bag technique-a tool making use of public health bag through wh...
 
Key note speaker Neum_Admir Softic_ENG.pdf
Key note speaker Neum_Admir Softic_ENG.pdfKey note speaker Neum_Admir Softic_ENG.pdf
Key note speaker Neum_Admir Softic_ENG.pdf
 
Holdier Curriculum Vitae (April 2024).pdf
Holdier Curriculum Vitae (April 2024).pdfHoldier Curriculum Vitae (April 2024).pdf
Holdier Curriculum Vitae (April 2024).pdf
 
Z Score,T Score, Percential Rank and Box Plot Graph
Z Score,T Score, Percential Rank and Box Plot GraphZ Score,T Score, Percential Rank and Box Plot Graph
Z Score,T Score, Percential Rank and Box Plot Graph
 
microwave assisted reaction. General introduction
microwave assisted reaction. General introductionmicrowave assisted reaction. General introduction
microwave assisted reaction. General introduction
 
social pharmacy d-pharm 1st year by Pragati K. Mahajan
social pharmacy d-pharm 1st year by Pragati K. Mahajansocial pharmacy d-pharm 1st year by Pragati K. Mahajan
social pharmacy d-pharm 1st year by Pragati K. Mahajan
 

"Introduction to JMeter" @ CPTM 3rd Session

  • 1. Introduction to JMeter By Ranil Weerasinghe & Tharinda Liyanage
  • 2. What will be covered… • 1st Phase • Getting to know about the tool • Types of Applications/protocols • Features • Installation and configuration • Components • Strengths and Weaknesses • 2nd phase • Practical session with examples
  • 3. What is JMeter • Performance testing tool (like LoadRunner, WebLoad, OpenSTA , etc) • It supports performance testing of: • Web application • Web services (SOAP and REST) • Database query performance • Mail - SMTP(S), POP3(S) and IMAP(S) • JMS • Mobile • Apache Project - http://jmeter.apache.org/ • 100% pure Java desktop application • Originally developed by Stefano Mazzocchi
  • 4. Features of JMeter • Load and performance test various protocols - HTTP(S), FTP, JDBC, JMS, LDAP, SOAP •HTTP proxy server for recording test scripts – eliminates 3rd party recording tools like “Badboy” •Platform Independent •Execution can do in batch mode and analyze offline. •Distributed testing. •Extensible. – Plugins (https://code.google.com/p/jmeter-plugins/)
  • 6. Strengths • Free and open source • Active development/ community • Extensibility • Capability of dynamic scripting/ generate load/ and reporting • Supports automation (Maven with Jenkins CI for performance testing in regression mode) • Cloud compatibility
  • 7. Weaknesses • Memory management issues But …adjust Heap memory/ use 64-bit version/ run non-GUI mode • Reports are a bit lacking But... Plugins provides many • Steep learning curve Lack of Training opportunities and require technical skills • Limited Support No dedicated support like commercial tools
  • 8. Setting Up and Running JMeter • The latest version of JMeter can be downloaded from the project website: http://jmeter.apache.org/download_jmeter.cgi • JMeter requires a fully compliant JVM 1.6 or higher.  You need Java, with the JAVA_HOME environment variable set. • To install a release build, simply unzip the zip/tar file into the directory where you want JMeter to be installed. • To run JMeter, run the jmeter.bat (for Windows) • or jmeter.sh (for Unix) file.
  • 9. JMeter Elements • Test Plan: where the overall settings for a test are specified. • Thread groups: defines a pool of users that will execute a particular test case against your server. • Samplers: sends requests to a server • Logical controllers : control flow of test plan (loops, conditionals, ordering, etc.) • Listeners: record, summarize and display record and response data • Timers: introduce delays in test plan • Assertions: assert facts about responses, for functional testing • Configuration elements: Configuration Elements set default values for other parts of the Test Plan as well as configure variables. • Pre-processors and post-processors • Workbench :It provides a place to temporarily store test elements while not in use for copy/paste purposes • JMeter Proxy Server : watch and record your actions while you browse your web application with your normal browser
  • 10. Test plan • Where the overall settings for a test are specified.
  • 11. Thread group • Thread group elements are the beginning points of any test plan. • It controls the number of threads JMeter will use to execute your test
  • 12. Samplers • Samplers tell JMeter to send requests to a server and wait for a response. • Processed in the order they appear in the tree. • Controllers can be used to modify the number of repetitions of a sampler. •HTTP Request • JDBC Request • Java object request • LDAP Request • SOAP/XML-RPC Request •FTP Request
  • 13. Logical controllers • Loop Controller • If controller • Transaction Controller • Recording Controller Logic Controllers determine the order in which Samplers are processed Some controller are:
  • 14. Listeners • “Listen" to the test results. • View, save, and read saved test results • Can be saved to JTL, CSV or XML format. • Listeners can be added anywhere in the test, including directly under the test plan.
  • 16. Timers • Add delay to script • If not, overwhelms your server • Ex: • Constant timer • Random timer • Synchronizing timer
  • 17. Assertions • Verify correctness of your response. • Ex: • Response assertion – Verify fields of response • Size assertion - tests that each response contains the right number of bytes in it • Duration assertion- tests response received within a given amount of time
  • 18. Functions & Variables • Variables – to parameterized •JMeter variables are local to each thread. •Referenced as ${VARIABLE} •Functions •Are special values that can populate fields of any Sampler or other element in a test tree ${__FunctionName()} • Types •Information •Ex: ${__log()} •Input •Ex: ${__StringFromFile()} •Calculations •Ex: ${__RandomString()}
  • 19. Demo
  • 20. 1. Adding a Thread Group Test Plan -> Thread Group – Number of thread – Ramp-up Period – Loop count 2. Adding a HTTP Request Defaults Test Plan -> Thread Group -> HTTP Request Defaults (HTTP Request Defaults saves you time when doing lots of HTTP Samplers) – Protocol – enter “HTTP” – Server name – enter “jakarta.apache.org” – Path – leave blank – Port number – enter “80” How to Build a Test Plan
  • 21. How to Build a Test Plan Cont.. 3. Adding a HTTP Proxy Server Workbench -> HTTP Proxy Server – Port field - Enter “9090” – Target Controller – click on the drop down and select “test plan > thread group” – Click the “add” button in “Patterns to include”. – This will create a blank entry. Enter “.*.html” – Click the “add” button in “Patterns to exclude”. – This will create a blank entry. Enter “.*.gif” – Click the “start” button at the bottom 4. Setting a Proxy in IE – Start Internet Explorer, but do not close Jmeter. – From the tool bar, click “tools -> internet options”. – Select the “connection” tab – Click “LAN settings” button – On the connections tab, check “Use a proxy server for your LAN”.
  • 22. How to Build a Test Plan Cont.. – Address – enter “Localhost” or the IP address of your system – Port – enter “9090”. – Click “ok” button – Click “ok” button again. This should return you to the browser – In the “Address” bar at the top, enter “http://jakarta.apache.org/jmeter/index.html” and hit the “enter” key. – Click on a few links on Jmeter's page. – Close internet explorer and bring up the JMeter window. 5. Adding a Listeners Test Plan -> Thread Group -> Listeners – Graph Results – View Results in table – View Results in tree – Aggregate report
  • 23. How to Build a Test Plan Cont.. 6. Adding a Cookie Manager Test Plan -> Thread Group -> HTTP Cookie Manager Many Web applications use cookies. JMeter provides cookie capabilities through a Cookie Manager. Adding this element to a thread group allows you to send cookies to the application being tested, just as Web browsers do.
  • 24. Creating a Load Test Scenario and Execution
  • 25. JMeter Performance Test Results- View Results Tree
  • 26. JMeter Performance Test Results- Summary Report
  • 27. Assertions • Assertions allow you to assert facts about responses received from the server being tested. Using an assertion, you can essentially "test" that your application is returning the results you expect it to.
  • 28. Parameterization – User Define Variables • Thread Group -> Config Element -> User Define Variables
  • 29. Parameterization – CSV Data Set Config • Thread Group -> Config Element -> CSV Data Set Config
  • 30. Parameterization – CSV Data Set Config
  • 33. Session Handling Cont.. • Thread Group -> Post-Processors -> Regular Expression Extractor
  • 34. Session Handling Cont.. Regular Expressions * - Matches 0 or more time + - Matches 1 or more time .(dot) – match any character ? – stop when first match succeeds ( and ) – these enclose the portion of the match string to be returned More Regular Expressions http://jakarta.apache.org/oro/api/org/ apache/oro/text/regex/package- summary.html
  • 37. JMeter Best Practices  Use non-GUI mode: jmeter -n -t test.jmx -l test.jtl  Use as few Listeners as possible; if using the -l flag as above they can all be deleted or disabled.  Don't use "View Results Tree" or "View Results in Table" listeners during the load test, use them only during scripting phase to debug your scripts.  Rather than using lots of similar samplers, use the same sampler in a loop, and use variables (CSV Data Set) to vary the sample. Or perhaps use the Access Log Sampler. [The Include Controller does not help here, as it adds all the test elements in the file to the test plan.]
  • 38. JMeter Best Practices Cont..  Don't use functional mode  Use CSV output rather than XML  Only save the data that you need  Use as few Assertions as possible
  • 39. JMeter Distributed Testing - Pre conditions • The firewalls on the systems are turned off. • All the clients are on the same subnet. • The server is in the same subnet, if 192.x.x.x or 10.x.x.x ip addresses are used. If the server doesn't use 192 or 10 ip address, there shouldn't be any problems. • Make sure jmeter can access the server. • Make sure you use the same version of Jmeter on all the systems. Mixing versions may not work correctly. • Following image Illustrate the way, how the JMeter Master / Slave configuration works