Practical Performance and Load Testing
Practical Performance and Load Testing
About the Book
Load testing is often neglected in software development. As a result, we often see websites crash due to load on the launch day. With more and more end-users accessing websites using various devices anytime, anywhere, the load demand for web apps grows exponentially. While awareness of the need for load testing is widely acknowledged, there has been little improvement in load testing in software development. That is why we see so many "XXX site crashed on the first day" news.
Here are the common challenges that software projects are now facing in load testing:
- Load testing tools are expensive
- Unable to load-test dynamic websites (using AJAX)
- Load testing is conducted rarely, and often too late
- Lack of skills in load testing
- Fragile load test scripts, unable to maintain them along with application changes
This book will show you a practical approach (Continuous Performance/Load Testing) to address the above.
- Support modern websites. All operations, including AJAX, can be load-tested easily.
- Free (as in freedom as well as free in ‘free beer'). The load test (and build) scripts are all in open-source and popular frameworks, with no vendor-locking. Load testing is no longer a luxury that only large software companies can afford.
- Immediate Result. Set up and running can be done within one day!
- Continuous Performance and Load Testing in a DevOps process. Detect performance or load issues early.
Table of Contents
-
Preface
- What makes this book unique?
- Who should read this book?
- How to read this book?
- Send me feedback
-
1 Introduction
- 1.1 Performance Testing vs Load Testing
- 1.2 Benefits of Load Testing for web apps
- 1.3 Why effective load testing is more necessary than ever?
- 1.4 Reality Check
- 1.5 Why do most projects do load testing poorly?
-
1.6 Load Testing Approaches
- 1.6.1 HTTP Protocol-based load testing
- 1.6.2 Real browser-based load testing
- 1.7 Review
-
2 Practical Load Testing
-
2.1 Load Testing Trends
- 2.1.1 Approach: Protocol-based ⇒ Browser-based
- 2.1.2 Who is doing load testing: one performance testing team ⇒ individual projects
- 2.1.3 Tools: Expensive commercial proprietary ⇒ Free and open-source scripting
- 2.1.4 Execution frequency: A few times ⇒ Early and frequently
- 2.1.5 Execution mindset: Long and Regid ⇒ Short and Relax
- 2.2 Success Factors
-
2.3 Practical Load Testing
- 2.3.1 The Team Owns it
- 2.3.2 Starting small, Starting today
- 2.3.3 Do it often as a part of CT
- 2.3.4 Make every load testing short, less stringent
- 2.3.5 Focus on the main, then the rest load testing targets
- 2.3.6 The Process
-
2.4 Case Study: How will I load test Census Australia?
- 2.4.1 Prerequisite
- 2.4.2 Process
- 2.4.3 The Cost
- 2.4.4 Why does it work?
- 2.4.5 FAQ
- 2.5 Review
-
2.1 Load Testing Trends
-
3 Protocol-based Performance and Load Testing
- 3.1 How does Protocol-based testing works?
- 3.2 Simple Performance/Load Testing Exercise
-
3.3 Scripting with Mechanize
- 3.3.1 Preparation
- 3.3.2 Performance Testing
- 3.3.3 Simple Load Testing
- 3.3.4 Compare load results
- 3.3.5 Failure to load test AJAX
-
3.4 Load testing with JMeter
- 3.4.1 Performance Testing
- 3.4.2 Load Testing
- 3.5 Handcrafted scripts vs GUI tools
- 3.6 Review
-
4 Test Syntax Framework
-
4.1 RSpec
- 4.1.1 Install and Run RSpec tests
- 4.1.2 A performance test in RSpec
- 4.2 Avoid Gherkin
- 4.3 Review
-
4.1 RSpec
-
5 First Functional Performance Test
- 5.1 Test Design
- 5.2 Install Testing Tool
- 5.3 New Performance Test Project
- 5.4 Run the blank test
-
5.5 Create test steps
- 5.5.1 Create test steps manually
- 5.5.2 Using TestWise Recorder
- 5.5.3 Test case
-
5.6 Add measurements
- 5.6.1 Measure timings in Ruby
- 5.7 Headless browser mode
- 5.8 Compare performance testing results
- 5.9 Measure AJAX operations
- 5.10 Functional Test vs Functional Performance Test
- 5.11 Review
-
6 Performance Test Plan
- 6.1 Scope of work
- 6.2 Testing execution approach
-
6.3 Automation framework
- 6.3.1 Protocol based frameworks
- 6.3.2 Browser based frameworks
- 6.4 Scripting language
- 6.5 Test Syntax framework
- 6.6 Test Creation: Recording vs Handcrafting
-
6.7 Automation Tools
- 6.7.1 Be efficient
- 6.7.2 Preview browser-based tests
-
6.8 Measurements
- 6.8.1 Operation types for measurements
- 6.8.2 Determine operations for timing
- 6.9 Test executions and Reporting
- 6.10 Review
-
7 Continuous Performance Testing
- 7.1 Why run performance tests in CT server
- 7.2 Set up BuildWise Server
-
7.3 Execute performance tests in a CT server
- 7.3.1 Prerequisite
- 7.3.2 Set a CT build project
- 7.3.3 Trigger a CT run
- 7.3.4 View Build result
- 7.3.5 Continuous Execution
- 7.4 Case Study - Performance Testing WhenWise’s Reset
- 7.5 Review
-
8 Load Test Plan
- 8.1 Load Testing Scenarios
- 8.2 Determine the number of VUs required
- 8.3 Generate Load
- 8.4 Load Testing Metrics
- 8.5 Define Success Criteria
- 8.6 Parallel Execution in a CT server
-
8.7 Execution Control
- 8.7.1 Testing What?
- 8.7.2 With how much load?
- 8.8 Review
-
9 Continuous Load Testing
- 9.1 Generate Load from the command line
-
9.2 How does Continuous Load Testing work?
- 9.2.1 Benefits
- 9.2.2 How can this approach handle a large load, e.g. 10000 concurrent users?
-
9.3 Build Agents
- 9.3.1 Build Agent Machines
- 9.3.2 Install BuildWise agent software
- 9.3.3 Configure first build agent
- 9.3.4 Verify software on an Agent machine
- 9.3.5 Verify Test Execution in an Agent
- 9.3.6 Configure - Pre Execution (optional)
- 9.3.7 Clone multiple build agents
- 9.4 Set up Load Testing project
- 9.5 Review
-
10 Custom Load Testing Execution
-
10.1 Control which tests to run
- 10.1.1 Focused Scenario(s)
- 10.1.2 Mix Scenarios
- 10.2 Prepare Execution
-
10.3 A Quick Test Run with one Build Agent
- 10.3.1 Build Agent Specifiction Affects Performance
-
10.4 Control the Load
- 10.4.1 Set VU count
- 10.4.2 Set test execution time
- 10.4.3 Increase the load gradually
-
10.5 Set Success Criteria
- 10.5.1 Overall failure rate
- 10.5.2 Indvidual Operation Timings
- 10.6 Monitor Execution
-
10.7 Case Study: Load Testing User Login
- 10.7.1 1 VU
- 10.7.2 3 VUs
- 10.7.3 6 VUs
- 10.7.4 9 VUs
- 10.7.5 12 VUs
- 10.7.6 Report
- 10.7.7 Analyse
- 10.7.8 What’s next?
- 10.7.9 Review
-
10.8 Case Study: Mixed Scenarios
- 10.8.1 Create a new Build Project by Clone
- 10.8.2 Test Scripts
- 10.8.3 Debug Operation Failure
- 10.8.4 Report
-
10.1 Control which tests to run
-
11 Identifying Flaws and Performance issues
-
11.1 Functional Flaws
- 11.1.1 Design Flaw
- 11.1.2 Race conditions
-
11.2 Non-Functional
- 11.2.1 Website Crash
- 11.2.2 Software Inefficient
- 11.2.3 Deployment/Infrastructure Flaw
- 11.3 Feedback Time is Critical
- 11.4 Performance/Load Improvement Suggestions
- 11.5 Review
-
11.1 Functional Flaws
-
12 Continuous Testing Lab
- 12.1 Costing Factor
- 12.2 Start Small, Start Today
- 12.3 Reliable
-
12.4 Ongoing Mainteance
- 12.4.1 Execution Environment
- 12.4.2 BuildWise Agent
- 12.4.3 App related
-
12.5 Optimize For Speed
- 12.5.1 Recommendations
- 12.6 Review
-
13 Maintaining Load Test Scripts
-
13.1 Reusable functions and Page Objects
- 13.1.1 Page Object Models
- 13.1.2 Reusable Helper Functions
- 13.2 Test Refactoring
- 13.3 Coding conventions
- 13.4 AJAX in Load Tests
- 13.5 Review
-
13.1 Reusable functions and Page Objects
-
14 Best Practices
- 14.1 Run a warm-up script first
-
14.2 Using faster Selenium operations
- 14.2.1 Prefer a faster locator
- 14.2.2 Avoid Selecting an option by Index
- 14.2.3 Reuse already located element
- 14.2.4 Submit form instead of clicking a submit button
- 14.2.5 Asserting page content using source
-
14.3 Speed up non-operational steps
- 14.3.1 Mimimize test data
- 14.3.2 Using JavaScript to enter text data
-
14.4 Avoid Conflicts
- 14.4.1 Stabilise load scripts with randomization
- 14.4.2 Leave no side effects
- 14.5 Review
-
Appendix: TestWisely
-
Test Scripts on Github
- Verify: Run tests on TestWise
-
Set up a CT Lab on TestWisely and Run Performance/Load Tests
- Sign up TestWisely
- Set up Wizard
- Set up Build Projects
-
Performance Testing
- Protocol-based
- Browser-based
- Execution
-
Load Testing
- Allocate Build Agents
- A Run of Load Testing on TestWisely’s BuildWise
-
How do Build Agents support different Apps?
- Test Scripts on Build Agents
- Update BuildWise Agent Configuration
- FAQ
-
Test Scripts on Github
-
Resources
- Books
- Tools
- Online
- References
The Leanpub 60 Day 100% Happiness Guarantee
Within 60 days of purchase you can get a 100% refund on any Leanpub purchase, in two clicks.
Now, this is technically risky for us, since you'll have the book or course files either way. But we're so confident in our products and services, and in our authors and readers, that we're happy to offer a full money back guarantee for everything we sell.
You can only find out how good something is by trying it, and because of our 100% money back guarantee there's literally no risk to do so!
So, there's no reason not to click the Add to Cart button, is there?
See full terms...
Earn $8 on a $10 Purchase, and $16 on a $20 Purchase
We pay 80% royalties on purchases of $7.99 or more, and 80% royalties minus a 50 cent flat fee on purchases between $0.99 and $7.98. You earn $8 on a $10 sale, and $16 on a $20 sale. So, if we sell 5000 non-refunded copies of your book for $20, you'll earn $80,000.
(Yes, some authors have already earned much more than that on Leanpub.)
In fact, authors have earnedover $14 millionwriting, publishing and selling on Leanpub.
Learn more about writing on Leanpub
Free Updates. DRM Free.
If you buy a Leanpub book, you get free updates for as long as the author updates the book! Many authors use Leanpub to publish their books in-progress, while they are writing them. All readers get free updates, regardless of when they bought the book or how much they paid (including free).
Most Leanpub books are available in PDF (for computers) and EPUB (for phones, tablets and Kindle). The formats that a book includes are shown at the top right corner of this page.
Finally, Leanpub books don't have any DRM copy-protection nonsense, so you can easily read them on any supported device.
Learn more about Leanpub's ebook formats and where to read them