Performance Testing with JMeter 3 - Third Edition
By Bayo Erinle
()
About this ebook
A practical guide to help you undertand the ability of Apache jMeter to load and performance test various server types in a more efficient way.
About This Book- Use jMeter to create and run tests to improve the performance of your webpages and applications
- Learn to build a test plan for your websites and analyze the results
- Unleash the power of various features and changes introduced in Apache jMeter 3.0
This book is for software professionals who want to understand and improve the performance of their applications with Apache jMeter.
What You Will Learn- See why performance testing is necessary and learn how to set up JMeter
- Record and test with JMeter
- Handle various form inputs in JMeter and parse results during testing
- Manage user sessions in web applications in the context of a JMeter test
- Monitor JMeter results in real time
- Perform distributed testing with JMeter
- Get acquainted with helpful tips and best practices for working with JMeter
JMeter is a Java application designed to load and test performance for web application. JMeter extends to improve the functioning of various other static and dynamic resources. This book is a great starting point to learn about JMeter. It covers the new features introduced with JMeter 3 and enables you to dive deep into the new techniques needed for measuring your website performance.
The book starts with the basics of performance testing and guides you through recording your first test scenario, before diving deeper into JMeter. You will also learn how to configure JMeter and browsers to help record test plans.
Moving on, you will learn how to capture form submission in JMeter, dive into managing sessions with JMeter and see how to leverage some of the components provided by JMeter to handle web application HTTP sessions. You will also learn how JMeter can help monitor tests in real-time.
Further, you will go in depth into distributed testing and see how to leverage the capabilities of JMeter to accomplish this. You will get acquainted with some tips and best practices with regard to performance testing. By the end of the book, you will have learned how to take full advantage of the real power behind Apache JMeter.
Style and approachThe book is a practical guide starting with introducing the readers to the importance of automated testing. It will then be a beginner's journey from getting introduced to Apache jMeter to an in-detail discussion of more advanced features and possibilities with it.
Bayo Erinle
Bayo Erinle is a senior software engineer with over nine years' experience in designing, developing, testing, and architecting software.He has worked in various spectrums of the IT field,including government, finance, and health care.As a result,he has been involved in the planning, development, implementation,integration,and testing of numerous applications, including multi-tiered,standalone,distributed, and cloud-based applications. He is always intrigued by new technology and enjoys learning new things.He currently resides in Maryland, US, and when he is not hacking away at some new technology,he enjoys spending time with his wife Nimota and their three children, Mayowa, Durotimi, and Fisayo.
Read more from Bayo Erinle
Performance Testing with JMeter 2.9 Rating: 0 out of 5 stars0 ratingsJMeter Cookbook Rating: 0 out of 5 stars0 ratingsPerformance Testing with JMeter - Second Edition Rating: 0 out of 5 stars0 ratings
Related to Performance Testing with JMeter 3 - Third Edition
Related ebooks
Mobile Test Automation with Appium Rating: 0 out of 5 stars0 ratingsRobot Framework Test Automation Rating: 4 out of 5 stars4/5Metasploit Bootcamp: The fastest way to learn Metasploit Rating: 0 out of 5 stars0 ratingsHands-On Test Management with Jira: End-to-end test management with Zephyr, synapseRT, and Jenkins in Jira Rating: 0 out of 5 stars0 ratingsMagento 2 Theme Design: Create stunning and responsive Magento 2 themes for your business, 2nd Edition Rating: 0 out of 5 stars0 ratingsTesting with JUnit Rating: 0 out of 5 stars0 ratingsLearning Informatica PowerCenter 10.x - Second Edition Rating: 0 out of 5 stars0 ratingsProgressive Web Apps with React: Create lightning fast web apps with native power using React and Firebase Rating: 0 out of 5 stars0 ratingsMastering Concurrency Programming with Java 9 - Second Edition Rating: 0 out of 5 stars0 ratingsPractical DevOps Rating: 3 out of 5 stars3/5Hands-on Testing with PHPUnit How-to: A practical guide to getting started with PHPUnit to improve code quality Rating: 0 out of 5 stars0 ratingsSpring Security: Secure your web applications, RESTful services, and microservice architectures Rating: 0 out of 5 stars0 ratingsMetasploit for Beginners Rating: 0 out of 5 stars0 ratingsMagento Extensions Development Rating: 0 out of 5 stars0 ratingsBuilding RESTful Web Services with Spring 5: Leverage the power of Spring 5.0, Java SE 9, and Spring Boot 2.0 Rating: 0 out of 5 stars0 ratingsE-learning with Camtasia Studio Rating: 0 out of 5 stars0 ratingsNeural Networks with R Rating: 0 out of 5 stars0 ratingsPractical Reinforcement Learning: Develop self-evolving, intelligent agents with OpenAI Gym, Python and Java Rating: 0 out of 5 stars0 ratingsIntroduction to JVM Languages Rating: 0 out of 5 stars0 ratingsLearning Spring 5.0 Rating: 0 out of 5 stars0 ratingsGetting Started with Review Board Rating: 0 out of 5 stars0 ratingsOracle JET for Developers: Implement client-side JavaScript efficiently for enterprise Oracle applications Rating: 0 out of 5 stars0 ratingsExtending Symfony2 Web Application Framework Rating: 0 out of 5 stars0 ratingsLearning Yii Testing Rating: 1 out of 5 stars1/5Puppet 5 Essentials - Third Edition Rating: 0 out of 5 stars0 ratingsModern R Programming Cookbook: Recipes to simplify your statistical applications Rating: 0 out of 5 stars0 ratingsPython High Performance - Second Edition Rating: 0 out of 5 stars0 ratings
Software Development & Engineering For You
Learn to Code. Get a Job. The Ultimate Guide to Learning and Getting Hired as a Developer. Rating: 5 out of 5 stars5/5PYTHON: Practical Python Programming For Beginners & Experts With Hands-on Project Rating: 5 out of 5 stars5/5Agile Practice Guide Rating: 4 out of 5 stars4/5Grokking Algorithms: An illustrated guide for programmers and other curious people Rating: 4 out of 5 stars4/5Python For Dummies Rating: 4 out of 5 stars4/5Good Code, Bad Code: Think like a software engineer Rating: 5 out of 5 stars5/5Agile Project Management: Scrum for Beginners Rating: 4 out of 5 stars4/5Ry's Git Tutorial Rating: 0 out of 5 stars0 ratingsHow to Write Effective Emails at Work Rating: 4 out of 5 stars4/5Level Up! The Guide to Great Video Game Design Rating: 4 out of 5 stars4/5Coding with AI For Dummies Rating: 0 out of 5 stars0 ratingsWordpress 2023 A Beginners Guide : Design Your Own Website With WordPress 2023 Rating: 0 out of 5 stars0 ratingsBeginning Programming For Dummies Rating: 4 out of 5 stars4/5Git Essentials Rating: 4 out of 5 stars4/5Making Money By Selling 3D Models Online Rating: 5 out of 5 stars5/5Kanban: A Quick and Easy Guide to Kickstart Your Project Rating: 4 out of 5 stars4/5RESTful API Design - Best Practices in API Design with REST: API-University Series, #3 Rating: 5 out of 5 stars5/5Hand Lettering on the iPad with Procreate: Ideas and Lessons for Modern and Vintage Lettering Rating: 4 out of 5 stars4/5Fundamentals of Software Engineering: Designed to provide an insight into the software engineering concepts Rating: 0 out of 5 stars0 ratingsLean Management for Beginners: Fundamentals of Lean Management for Small and Medium-Sized Enterprises - With many Practical Examples Rating: 0 out of 5 stars0 ratingsTiny Python Projects: Learn coding and testing with puzzles and games Rating: 4 out of 5 stars4/5UX Simplified: Models & Methodologies Rating: 3 out of 5 stars3/5Adobe Illustrator CC For Dummies Rating: 5 out of 5 stars5/5Case Studies in Design Patterns Rating: 5 out of 5 stars5/5DevOps: Introduction to DevOps and its impact on Business Ecosystem: Introduction to DevOps and its impact on Business Ecosystem Rating: 0 out of 5 stars0 ratingsArt of Clean Code: How to Write Codes for Human Rating: 3 out of 5 stars3/5
Reviews for Performance Testing with JMeter 3 - Third Edition
0 ratings0 reviews
Book preview
Performance Testing with JMeter 3 - Third Edition - Bayo Erinle
Performance Testing with JMeter 3
Third Edition
Enhance the performance of your web application
Bayo Erinle
BIRMINGHAM - MUMBAI
Performance Testing with JMeter 3
Third Edition
Copyright © 2017 Packt Publishing
All rights reserved. No part of this book may be reproduced, stored in a retrieval system, or transmitted in any form or by any means, without the prior written permission of the publisher, except in the case of brief quotations embedded in critical articles or reviews.
Every effort has been made in the preparation of this book to ensure the accuracy of the information presented. However, the information contained in this book is sold without warranty, either express or implied. Neither the author, nor Packt Publishing, and its dealers and distributors will be held liable for any damages caused or alleged to be caused directly or indirectly by this book.
Packt Publishing has endeavored to provide trademark information about all of the companies and products mentioned in this book by the appropriate use of capitals. However, Packt Publishing cannot guarantee the accuracy of this information.
First published: July 2013
Second edition: April 2015
Third edition: July 2017
Production reference: 1170717
Published by Packt Publishing Ltd.
Livery Place
35 Livery Street
Birmingham
B3 2PB, UK.
ISBN 978-1-78728-577-4
www.packtpub.com
Credits
About the Author
Bayo Erinle is an author and senior software engineer with over 14 years of experience in designing, developing, testing, and architecting software. He has worked in various spectrums of the IT field, including government, commercial, finance, and health care. As a result, he has been involved in the planning, development, implementation, integration, operations, and testing of numerous applications, including multitiered, standalone, distributed, and cloud-based applications. He is passionate about programming, performance, operations, scalability, and all things technical. He is always intrigued by new technology and enjoys learning new things.
He currently resides in Maryland, US, and when he is not hacking away at some new technology, he enjoys spending time with his wife, Nimota, and their three children, Mayowa, Durotimi, and Fisayo.
He also authored Performance Testing with JMeter 2.9 (first edition and second edition) and JMeter Cookbook, both by Packt.
Acknowledgments
I would like to thank all those people who helped make this book a reality. First, I want to thank God for the strength; through Him, I can do all things! Secondly, Nimota, my wife, for her encouragement, support, and picking up the slack while I took time to write the book. Thanks to my kids for their several hugs, kisses, and amusement to keep me going. Thanks to the folks at Packt for believing in me enough to give me yet another opportunity to author the third edition of this book. Lastly, thanks to the readers of the first and second editions of this book, and to all the future readers of this edition; your support is greatly appreciated.
About the Reviewers
Ripon Al Wasim has over 16 years of experience in the software industry. His professional experiences include software development, functional and non-functional testing (both manual and automated testing). He currently works as senior software engineer at Cefalo Bangladesh Ltd. (http://www.cefalo.com/).
Ripon is a hunter of new technology and is very passionate about test automation.
He is an active participant in the professional community of Stack Overflow: http://stackoverflow.com/users/617450/ripon-al-wasim.
Ripon is the author of Mastering Selenium Testing Tools (https://www.packtpub.com/web-development/mastering-selenium-testing-tools-video), a video tutorial published by Packt.
He has reviewed the following books published by Packt:
Selenium WebDriver Practical Guide (https://www.packtpub.com/web-development/selenium-webdriver-practical-guide).
Performance Testing with JMeter - Second Edition (https://www.packtpub.com/application-development/performance-testing-jmeter-second-edition).
Mastering Selenium WebDriver (https://www.packtpub.com/web-development/mastering-selenium-webdriver).
I would like to thank my mother for always praying for me. In my spare time, I love to spend time with my wife, Koly, as well as my twin babies, Nawar and Nazif.
Vinay Madan is currently a QA Lead with SecurePay (www.securepay.com.au). He has more than 10 years of experience in the diversified fields of software testing, quality assurance, test management, and agile software development.
He has worked on projects for leading international clients for payment gateway, eWallet, smart cards issuance, big data, security, telecom, and e-learning. He is an avid learner with strong technical expertise in functional and performance testing tools such as Selenium, QTP, Cucumber, Serenity BDD, JMeter, and Load Runner.
Over the years, Vinay has worked with multiple software methodologies, including Agile, Scrum, and Customized Waterfall for Windows, the web, and mobile. He is passionate about automation and open source technologies, and loves sharing his knowledge on blogs and forums.
Thank you, mom, for everything. I would also like to thank my wife for her everlasting love and support.
www.PacktPub.com
For support files and downloads related to your book, please visit www.PacktPub.com.
Did you know that Packt offers eBook versions of every book published, with PDF and ePub files available? You can upgrade to the eBook version at www.PacktPub.com and as a print book customer, you are entitled to a discount on the eBook copy. Get in touch with us at [email protected] for more details.
At www.PacktPub.com, you can also read a collection of free technical articles, sign up for a range of free newsletters and receive exclusive discounts and offers on Packt books and eBooks.
https://www.packtpub.com/mapt
Get the most in-demand software skills with Mapt. Mapt gives you full access to all Packt books and video courses, as well as industry-leading tools to help you plan your personal development and advance your career.
Why subscribe?
Fully searchable across every book published by Packt
Copy and paste, print, and bookmark content
On demand and accessible via a web browser
Customer Feedback
Thanks for purchasing this Packt book. At Packt, quality is at the heart of our editorial process. To help us improve, please leave us an honest review on this book's Amazon page at https://www.amazon.com/dp/1787285774. If you'd like to join our team of regular reviewers, you can e-mail us at [email protected]. We award our regular reviewers with free eBooks and videos in exchange for their valuable feedback. Help us be relentless in improving our products!
Table of Contents
Preface
What this book covers
What you need for this book
Who this book is for
Conventions
Reader feedback
Customer support
Downloading the example code
Errata
Piracy
Questions
Performance Testing Fundamentals
The incident
The aftermath
Performance testing
Performance testing and tuning
Baselines
Load and stress testing
JMeter to the rescue
Up and running with JMeter
Installation
Installing Java JDK
Setting up JAVA_HOME
On Windows
On Unix
Running JMeter
Command-line options
JMeter's classpath
Configuring a proxy server
Running in non-GUI mode
Running in server mode
Overriding properties
Tracking errors during test execution
Configuring JMeter
Summary
Recording Your First Test
Configuring the JMeter HTTP(S) Test Script Recorder
Setting up your browser to use the proxy server
Using a browser extension
Changing the machine system settings
Running your first recorded scenario
Excilys bank case study
Parameterizing the script
Extracting information during test run
Anatomy of a JMeter test
Test plan
Thread groups
Controllers
Samplers
Logic controllers
Test fragments
Listeners
Timers
Assertions
Configuration elements
Preprocessor and Postprocessor elements
Summary
Submitting Forms
Capturing simple forms
Handling checkboxes
Handling radio buttons
Handling file uploads
Handling file downloads
Posting JSON data
Reading JSON data
Using JSR223 PostProcessor
Handling XML responses
Summary
Managing Sessions
Managing sessions with cookies
Managing sessions with URL rewriting
Summary
Monitoring Tests in Real-Time
Setting up InfluxDB
Setting up Grafana
Creating an InfluxDB database for our test plan
Connecting Grafana to the database
Putting it all together
Importing the Grafana dashboard
Summary
Distributed Testing
Remote testing with JMeter
Configuring JMeter slave nodes
Configuring one slave per machine
Configuring the master node
Configuring multiple slave nodes on a single box
Configuring the master node
Leveraging the cloud for distributed testing
Obtaining your access key, secret key, and key pair
Launching the AWS instance
Executing the test plan
Viewing the results from the virtual machines
Using cloud services
Using Flood.io
Using BlazeMeter
Summary
Helpful Tips - Part 1
Dummy Sampler
Debug Sampler
JDBC Request Sampler
Setting up the H2 database
Configuring a JDBC Connection Configuration component
Adding a JDBC Request Sampler
Using a MongoDB Sampler
Summary
Helpful Tips - Part 2
JMeter properties and variables
JMeter functions
Using timers in your test plan
The Constant Timer
The Gaussian Random Timer
The Uniform Random Timer
The Constant Throughput Timer
The Synchronizing Timer
The Poisson Random Timer
The Regular Expression tester
The JSON Path Extractor element
Handling RESTful web services
Working with the reporting dashboard
Summary
Preface
Performance testing is a type of testing intended to determine the responsiveness, reliability, throughput, interoperability, and scalability of a system and/or application under a given workload. It is critical and essential to the success of any software product's launch and maintenance. It also plays an integral part in scaling an application out to support a wider user base.
Apache JMeter is a free and open source, cross-platform performance testing tool that has been around since the late 90s. It is mature, robust, portable, and highly extensible. It has a large user base and offers a lot of plugins to aid testing.
This is a practical hands-on book that focuses on how to leverage Apache JMeter to meet your testing needs. It starts with a quick introduction on performance testing, but quickly moves into engaging topics including recording test scripts, monitoring system resources, an extensive look at several JMeter components, leveraging the cloud for testing, extending Apache JMeter capabilities via plugins, and so on. Along the way, you will do some scripting, learn and use tools such as Vagrant and Apache Tomcat, and be armed with all the knowledge you need to take on your next testing engagement.
Whether you are a developer or tester, this book is sure to impact you with some valuable knowledge to aid you in attaining success in your future testing endeavors.
What this book covers
Chapter 1, Performance Testing Fundamentals, covers the fundamentals of performance testing and the installation and configuration of JMeter.
Chapter 2, Recording Your First Test, dives into recording your first JMeter test script and covers the anatomy of a JMeter test script.
Chapter 3, Submitting Forms, explores form submission in detail. It includes handling various HTML form elements (checkboxes, radio, file uploads and downloads, and so on), JSON data, and XML.
Chapter 4, Managing Sessions, explains session management, including cookies and URL rewriting.
Chapter 5, Monitoring Tests in Real-Time, focuses