Selenium Framework Design in Data-Driven Testing

Take a deep dive into building data-driven test frameworks using Selenium WebDriver
Preview in Mapt

Selenium Framework Design in Data-Driven Testing

Carl Cocchiaro

Take a deep dive into building data-driven test frameworks using Selenium WebDriver
Mapt Subscription
FREE
$29.99/m after trial
eBook
$18.00
RRP $35.99
Save 49%
Print + eBook
$44.99
RRP $44.99
What do I get with a Mapt Pro subscription?
  • Unlimited access to all Packt’s 5,000+ eBooks and Videos
  • Early Access content, Progress Tracking, and Assessments
  • 1 Free eBook or Video to download and keep every month after trial
What do I get with an eBook?
  • Download this book in EPUB, PDF, MOBI formats
  • DRM FREE - read and interact with your content when you want, where you want, and how you want
  • Access this title in the Mapt reader
What do I get with Print & eBook?
  • Get a paperback copy of the book delivered to you
  • Download this book in EPUB, PDF, MOBI formats
  • DRM FREE - read and interact with your content when you want, where you want, and how you want
  • Access this title in the Mapt reader
What do I get with a Video?
  • Download this Video course in MP4 format
  • DRM FREE - read and interact with your content when you want, where you want, and how you want
  • Access this title in the Mapt reader
$0.00
$18.00
$44.99
$29.99 p/m after trial
RRP $35.99
RRP $44.99
Subscription
eBook
Print + eBook
Start 14 Day Trial

Frequently bought together


Selenium Framework Design in Data-Driven Testing Book Cover
Selenium Framework Design in Data-Driven Testing
$ 35.99
$ 18.00
Learning Continuous Integration with Jenkins - Second Edition Book Cover
Learning Continuous Integration with Jenkins - Second Edition
$ 35.99
$ 18.00
Buy 2 for $35.00
Save $36.98
Add to Cart

Book Details

ISBN 139781788473576
Paperback323 pages

Book Description

The Selenium WebDriver 3.x Technology is an open source API available to test both Browser and Mobile applications. It is completely platform independent in that tests built for one browser or mobile device, will also work on all other browsers and mobile devices. Selenium supports all major development languages which allow it to be tied directly into the technology used to develop the applications. This guide will provide a step-by-step approach to designing and building a data-driven test framework using Selenium WebDriver, Java, and TestNG.

The book starts off by introducing users to the Selenium Page Object Design Patterns and D.R.Y Approaches to Software Development. In doing so, it covers designing and building a Selenium WebDriver framework that supports both Browser and Mobile Devices. It will lead the user through a journey of architecting their own framework with a scalable driver class, Java utility classes, JSON Data Provider, Data-Driven Test Classes, and support for third party tools and plugins.

Users will learn how to design and build a Selenium Grid from scratch to allow the framework to scale and support different browsers, mobile devices, versions, and platforms, and how they can leverage third party grids in the Cloud like SauceLabs.

Other topics covered include designing abstract base and sub-classes, inheritance, dual-driver support, parallel testing, testing multi-branded applications, best practices for using locators, and data encapsulation.

Finally, you will be presented with a sample fully-functional framework to get them up and running with the Selenium WebDriver for browser testing.

By the end of the book, you will be able to design your own automation testing framework and perform data-driven testing with Selenium WebDriver.

Table of Contents

Chapter 1: Building a Scalable Selenium Test Driver Class for Web and Mobile Applications
Introduction
The singleton driver class
Using preferences to support browsers and platforms
Using preferences to support mobile device simulators, emulators, and real devices
Multithreading support for parallel and distributed testing
Passing optional arguments and parameters to the driver
Selenium Grid Architecture support using the RemoteWebDriver and AppiumDriver classes
Third-party grid architecture support including the Sauce Labs Test Cloud
Using property files to select browsers, devices, versions, platforms, languages, and many more
Summary
Chapter 2: Selenium Framework Utility Classes
Introduction
Global variables
Synchronization utility classes
The JavascriptExecutor class
The TestNG Listener class
File I/O class
The image capture class
The reporter class
The JavaMail class
Summary
Chapter 3: Best Practices for Building Selenium Page Object Classes
Introduction
Best practices for naming conventions, comments, and folder structures
Designing and building the abstract base classes for the AUT
Designing and building subclasses for feature-specific pages using inheritance techniques
Encapsulation and using getter/setter methods to retrieve objects from the page object classes
Exception handling and synchronization in page object class methods
Table classes
Summary
Chapter 4: Defining WebDriver and AppiumDriver Page Object Elements
Introduction
Inspecting page elements on browser applications
Inspection of page elements on mobile applications
Standards for using static locators
Standards for using dynamic locators
Summary
Chapter 5: Building a JSON Data Provider
Introduction
The TestNG Data Provider class
Extracting JSON data into Java objects
Filtering test data
JSON Data File formats
The JSONObject class
Summary
Chapter 6: Developing Data-Driven Test Classes
Introduction
Annotating test class methods using TestNG
TestNG setup/teardown methods
Naming conventions for test methods
Using the TestNG DataProvider
Calling page object methods in test classes
Exception handling in test classes
Designing base setup classes
TestNG suite file structure
Suite parameters
Summary
Chapter 7: Encapsulating Data in Data-Driven Testing
Introduction
Casting JSON data to Java objects
Building in positive, negative, boundary, and limit testing
Confirmation and exception property files
Property files and parsing test data on the fly
Global variables versus dynamic data
Processing JVM args
Retrieving JSON data outside of test methods
Supporting multibranded applications
Multiple driver support
Parallel testing
Summary
Chapter 8: Designing a Selenium Grid
Introduction
Virtual grids
Selenium driver class – WebDriver versus RemoteWebDriver
Switching from local to remote driver
Selenium standalone server and client drivers
Selenium standalone server and browser driver command-line options
Appium server and mobile simulator/emulator command-line options
Selenium Grid console
Directing traffic to Selenium nodes
Chapter 9: Third-Party Tools and Plugins
Introduction
IntelliJ IDEA Selenium plugin
TestNG results in IntelliJ and Jenkins
HTML Publisher Plugin
BrowserMob Proxy Plugin
ExtentReports Reporter API class
Sauce Labs Test Cloud services
Summary
Chapter 10: Working Selenium WebDriver Framework Samples
Introduction
Selenium driver and DataProvider classes
Selenium utility classes
ExtentReports classes
Browser page object base and subclasses
Browser test class and data files
Browser Suite XML and Maven Pom XML files
Summary

What You Will Learn

  • Design the Selenium Driver Class for local, remote, and third party grid support
  • Build Page Object Classes using the Selenium Page Object Model
  • Develop Data-Driven Test Classes using the TestNG framework
  • Encapsulate Data using the JSON Protocol
  • Build a Selenium Grid for RemoteWebDriver Testing
  • Construct Utility Classes for use in Synchronization, File I/O, Reporting and Test Listener Classes
  • Run the sample framework and see the benefits of a live data-driven framework in real-time

Authors

Table of Contents

Chapter 1: Building a Scalable Selenium Test Driver Class for Web and Mobile Applications
Introduction
The singleton driver class
Using preferences to support browsers and platforms
Using preferences to support mobile device simulators, emulators, and real devices
Multithreading support for parallel and distributed testing
Passing optional arguments and parameters to the driver
Selenium Grid Architecture support using the RemoteWebDriver and AppiumDriver classes
Third-party grid architecture support including the Sauce Labs Test Cloud
Using property files to select browsers, devices, versions, platforms, languages, and many more
Summary
Chapter 2: Selenium Framework Utility Classes
Introduction
Global variables
Synchronization utility classes
The JavascriptExecutor class
The TestNG Listener class
File I/O class
The image capture class
The reporter class
The JavaMail class
Summary
Chapter 3: Best Practices for Building Selenium Page Object Classes
Introduction
Best practices for naming conventions, comments, and folder structures
Designing and building the abstract base classes for the AUT
Designing and building subclasses for feature-specific pages using inheritance techniques
Encapsulation and using getter/setter methods to retrieve objects from the page object classes
Exception handling and synchronization in page object class methods
Table classes
Summary
Chapter 4: Defining WebDriver and AppiumDriver Page Object Elements
Introduction
Inspecting page elements on browser applications
Inspection of page elements on mobile applications
Standards for using static locators
Standards for using dynamic locators
Summary
Chapter 5: Building a JSON Data Provider
Introduction
The TestNG Data Provider class
Extracting JSON data into Java objects
Filtering test data
JSON Data File formats
The JSONObject class
Summary
Chapter 6: Developing Data-Driven Test Classes
Introduction
Annotating test class methods using TestNG
TestNG setup/teardown methods
Naming conventions for test methods
Using the TestNG DataProvider
Calling page object methods in test classes
Exception handling in test classes
Designing base setup classes
TestNG suite file structure
Suite parameters
Summary
Chapter 7: Encapsulating Data in Data-Driven Testing
Introduction
Casting JSON data to Java objects
Building in positive, negative, boundary, and limit testing
Confirmation and exception property files
Property files and parsing test data on the fly
Global variables versus dynamic data
Processing JVM args
Retrieving JSON data outside of test methods
Supporting multibranded applications
Multiple driver support
Parallel testing
Summary
Chapter 8: Designing a Selenium Grid
Introduction
Virtual grids
Selenium driver class – WebDriver versus RemoteWebDriver
Switching from local to remote driver
Selenium standalone server and client drivers
Selenium standalone server and browser driver command-line options
Appium server and mobile simulator/emulator command-line options
Selenium Grid console
Directing traffic to Selenium nodes
Chapter 9: Third-Party Tools and Plugins
Introduction
IntelliJ IDEA Selenium plugin
TestNG results in IntelliJ and Jenkins
HTML Publisher Plugin
BrowserMob Proxy Plugin
ExtentReports Reporter API class
Sauce Labs Test Cloud services
Summary
Chapter 10: Working Selenium WebDriver Framework Samples
Introduction
Selenium driver and DataProvider classes
Selenium utility classes
ExtentReports classes
Browser page object base and subclasses
Browser test class and data files
Browser Suite XML and Maven Pom XML files
Summary

Book Details

ISBN 139781788473576
Paperback323 pages
Read More

Read More Reviews

Recommended for You

Learning Continuous Integration with Jenkins - Second Edition Book Cover
Learning Continuous Integration with Jenkins - Second Edition
$ 35.99
$ 18.00
Kubernetes for Serverless Applications Book Cover
Kubernetes for Serverless Applications
$ 35.99
$ 18.00
Building RESTful Web Services with Spring 5 - Second Edition Book Cover
Building RESTful Web Services with Spring 5 - Second Edition
$ 35.99
$ 18.00
Data-Driven Testing in Selenium [Video] Book Cover
Data-Driven Testing in Selenium [Video]
$ 124.99
$ 25.00
Design a Selenium Test Framework from Scratch-Architect level [Video] Book Cover
Design a Selenium Test Framework from Scratch-Architect level [Video]
$ 100.99
$ 20.20
Practical Game Design Book Cover
Practical Game Design
$ 35.99
$ 18.00