Effective Web Test Automation with Selenium WebDriver and JUnit
Effective Web Test Automation with Selenium WebDriver and JUnit
About the Book
Effective Web Test Automation with Selenium WebDriver and JUnit brings together two essential disciplines, end-to-end (E2E) test automation and continuous testing, in one concise, practical guide.
Designed for beginners, it leads readers step by step through building and maintaining reliable, production-ready E2E tests for a real web application through more than 20 hands-on exercises using Selenium WebDriver in Java. Along the way, readers will master core web automation skills such as test execution, debugging, stabilization, refactoring, and maintainable test design.
The book also introduces the fundamentals of continuous testing, applying the same test suite developed throughout the exercises. It explores sequential and parallel execution with build agents, along with powerful CT server features for achieving fast and reliable test results.
Table of Contents
- Foreword
- Preface
- Why this book?
- What’s unique about this book series?
- Who should read this book?
- How to read this book?
- Send me feedback
- 1: Introduction
- 1.1: Goal
- 1.2: A Story
- 1.3: E2E Test Automation and Continuous Testing: Universal Skills for Rapid Results
- 1.4: Book Structure
- 2: Set up Selenium WebDriver
- 2.1: Installation
- 2.2: Run a sample automation script
- 2.3: Run a sample automated test script
- 3: Run your first Selenium WebDriver Test
- 3.1: Selenium JUnit Test Structure
- 3.2: First Test: User Login
- 3.3: Rename the test script file and add the first step
- 3.4: Add more user login steps and complete the login test case
- 3.5: Run your test
- 3.6: Add Verification
- 3.7: Add a user login failed test case in a separate test script
- 3.8: Refactoring: Merge two user login test cases into one test script file
- 3.9: Run the test script
- 4: Project Structure & Tools
- 4.1: Test Project Structure
- 4.2: Setting up IntelliJ IDEA
- 4.3: Run Entire Test Script in IntelliJ IDEA
- 4.4: Run Individual Test Case in IntelliJ IDEA
- 4.5: Benefits of using an IDE
- 5: Gain Productivity
- 5.1: Tools in the Selenium suite
- 5.2: Some beginner-friendly features in IntelliJ IDEA
- 6: Design with Maintenance in Mind
- 6.1 Create a New Test Script in IntelliJ
- 6.2 Extract to Function Refactoring: Login
- 6.3 Functional Test Refactoring Rhythm
- 6.4 Move Login Function to TestHelper
- 6.5 Use the TestHelper’s Login in Other Test Scripts
- 6.6 Introduce AbstractTest
- 6.7 Wrap Up
- 7: More Tests
- 7.1 “Remember Me” Sign In
- 7.2 A Business User Cannot Access Other Businesses’ Resources
- 7.3 Business User Shall Not Be Able to View or Edit User Details
- 7.4 Create Client
- 7.5 Search Client
- 7.6 Create a Group Lesson on Calendar
- 7.7 Create Recurring Group Lessons on Calendar
- 7.8 Run the Whole Suite with Ant
- 8: Refactoring to Page Object Model
- 8.1 Page Object Model
- 8.2 Maintainable Test Design: Test Helper and POM
- 8.3 Refactoring POMs with Tool Support
- 8.4 Case Study: Extract to Page Function
- 8.5 Case Study: Introduce Page Object
- 8.6 Case Study: Rename
- 8.7 Summary
- 9: More Tests Again
- 9.1 Register User Books a Group Lesson
- 9.2 Client Can Cancel Class Booking Under “My Bookings”
- 9.3 A Registered User Can Make a One-on-One Booking
- 9.4 A Registered User Can Cancel a Recent Booking
- 9.5 Wizard to Set Up a New Business
- 9.6 Business User Sets Business Hours for Individual Physical Resource
- 9.7 Business Can Enable and Disable Client Management
- 9.8 Scan QR to Register/Cancel Group Lesson (Last 4 Phone Digits)
- 9.9 Responsive UI
- 9.10 API Testing: Referral Get Payment Records
- 9.11 Wrap Up
- 10: Set up Continuous Execution
- 10.1 Selenium Official Continuous Execution Options
- 10.2 Install BuildWise Server
- 10.3 Git Repository Setup
- 10.4 Test Execution Environment Setup
- 10.5 Set Up a BuildWise Project
- 10.6 Test Execution in BuildWise
- 11: Sequential Execution in BuildWise
- 11.1 First Three Runs
- 11.2 Fix the Build
- 11.3 Getting the First Green Run
- 11.4 CT Role in Stabilizing and Debugging Test Failures
- 11.5 Test Execution History
- 11.6 Custom Test Execution
- 11.7 Quick Navigation to the Failed Test Line
- 11.8 View Screenshot
- 11.9 Toggle Headless Mode
- 11.10 Custom Target Server URL
- 11.11 Two BuildWise Features Unavailable to Test Scripts in Java
- 11.12 Wrap Up
- 12: Parallel Execution in BuildWise
- 12.1 Run BuildWise in Production Mode
- 12.2 Build Agent Machines
- 12.3 How Parallel Build Works in BuildWise?
- 12.4 Create a Parallel Build Project
- 12.5 First Parallel Run
- 12.6 Multi-Agents Against the Single Server
- 12.7 Remove Test Execution Dependencies Among Test Scripts
- 12.8 Multi-Agents Against the Multi-Servers
- 12.9 Some Great BuildWise CT Features for Parallel Test Execution
- 12.10 Wrap Up
- 13: Effective Web Test Automation
- 13.1 Implied Meanings of “Effective”
- 13.2 Many End-to-End Test Automation Efforts Fail Due to Ineffectiveness
- 13.3 How This Book’s Approach Addresses the Challenges
- Afterword
- Resources
- 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