万本电子书0元读

万本电子书0元读

顶部广告

Selenium Framework Design in Data-Driven Testing电子书

售       价:¥

6人正在读 | 0人评论 9.8

作       者:Carl Cocchiaro

出  版  社:Packt Publishing

出版时间:2018-01-23

字       数:39.4万

所属分类: 进口书 > 外文原版书 > 电脑/网络

温馨提示:数字商品不支持退换货,不提供源文件,不支持导出打印

为你推荐

  • 读书简介
  • 目录
  • 累计评论(0条)
  • 读书简介
  • 目录
  • 累计评论(0条)
Take a deep dive into building data-driven test frameworks using Selenium WebDriver About This Book ? A comprehensive guide to designing data-driven test frameworks using the Selenium 3 WebDriver API, AppiumDriver API, Java-Bindings, and TestNG ? Learn how to use Selenium Page Object Design Patterns and D.R.Y. (Don’t Repeat Yourself) Approaches to software development in automated testing ? Discover the Selenium Grid Architecture and build your own grid for browser and mobile devices ? Use third party tools and services like ExtentReports for results processing, reporting, and SauceLabs for cloud-based test services Who This Book Is For This book is intended for software quality assurance/testing professionals, software project managers, or software developers with prior experience in using Selenium and Java to test web-based applications.This book is geared towards the quality assurance and development professionals responsible for designing and building enterprise-based testing frameworks.The user should have a working knowledge of the Java, TestNG, and Selenium technologies 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 In Detail 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. Style and approach A comprehensive approach to designing data-driven test frameworks using the Selenium 3 WebDriver API, Java-Bindings, and TestNG Technologies
目录展开

Title Page

Copyright and Credits

Selenium Framework Design in Data-Driven Testing

Dedication

Packt Upsell

Why subscribe?

PacktPub.com

Contributors

About the author

About the reviewer

Packt is searching for authors like you

Preface

Who this book is for

What this book covers

To get the most out of this book

Download the example code files

Conventions used

Get in touch

Reviews

Building a Scalable Selenium Test Driver Class for Web and Mobile Applications

Introduction

Data-driven testing

Selenium Page Object Model

DRY

What you will learn

The singleton driver class

Requirements

The class signature

Class variables

JavaDoc

Parameters

Class methods

Using preferences to support browsers and platforms

Browser preferences

Platforms

Using preferences to support mobile device simulators, emulators, and real devices

iOS preferences

Android preferences

Multithreading support for parallel and distributed testing

Passing optional arguments and parameters to the driver

varargs

The parameter for setDriver

JVM argument – -Dswitch

Parameter processing methods

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

Selenium Framework Utility Classes

Introduction

Global variables

Synchronization utility classes

Selenium synchronization classes

The ExpectedConditions class

WebDriverWait/FluentWait classes

Custom synchronization methods

The JavascriptExecutor class

The TestNG Listener class

Building the test listener class

Logging the results to the console or log file

Including the test runner in the test class or suite

File I/O class

Property files

Lookup table files

CSV files

Log files

The image capture class

The capture screen method

The capture image method

The compare image method

The reporter class

The JavaMail class

Summary

Best Practices for Building Selenium Page Object Classes

Introduction

What you will learn

Best practices for naming conventions, comments, and folder structures

Naming conventions

Comments

Folder names and structures

Designing and building the abstract base classes for the AUT

The abstract class

Abstract methods

Common locators

Common methods

Wrap up on base classes

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

Implicit exception handling

TestNG difference viewer

Explicit exception handling

Try...catch exception handling

Synchronizing methods

Table classes

Summary

Defining WebDriver and AppiumDriver Page Object Elements

Introduction

Inspecting page elements on browser applications

Types of locators

Inheriting WebElements

Inspecting WebElements

Third-party plugins/tools

Inspection of page elements on mobile applications

Appium inspector

Inspecting mobile elements

Standards for using static locators

Rules for using standard locators

Simple locators

CSS locators

XPath query locators

Referencing static elements in methods

Retrieving static elements from other classes

Standards for using dynamic locators

Single attribute XPath versus CSS locators

WebElements

MobileElements

Multiple attribute XPath versus CSS locators

Using dynamic locators in methods

Summary

Building a JSON Data Provider

Introduction

What you will learn

The TestNG Data Provider class

The @DataProvider annotation

The @Test annotation

Extracting JSON data into Java objects

Filtering test data

Filtering include and exclude patterns

JSON Data File formats

The JSONObject class

Summary

Developing Data-Driven Test Classes

Introduction

Annotating test class methods using TestNG

TestNG annotations

@Test

TestNG setup/teardown methods

Setup methods

@BeforeSuite, @BeforeTest, @BeforeGroups, @BeforeClass, and @BeforeMethod

Teardown methods

@AfterSuite, @AfterTest, @AfterGroups, @AfterClass, and @AfterMethod

Order of precedence

Naming conventions for test methods

Test classes and data files

Test methods

Test parameters

Test groups

Test setup/teardown methods

Using the TestNG DataProvider

Calling page object methods in test classes

Exception handling in test classes

Test methods

The setup/teardown methods

The ITestResult class

Test listener/reporter classes

Designing base setup classes

TestNG suite file structure

Suite section: <suite>

Groups section: <groups>

Listeners section: <listeners>

Test section: <test>

Suite parameters

@Parameters

Summary

Encapsulating Data in Data-Driven Testing

Introduction

Casting JSON data to Java objects

JSON object

Sequential numbering of row IDs in the data file

Using Java object getter/setter methods

Passing data to page object methods

Building in positive, negative, boundary, and limit testing

Negative testing

Confirmation and exception property files

Property files

Lookup method in DataProvider

JSON data file data

Converting confirmation/error code on the fly

Property files and parsing test data on the fly

Environment property files

System properties

Initializing property file data

Global variables versus dynamic data

Processing JVM args

Retrieving JSON data outside of test methods

Supporting multibranded applications

Multilocators

Conditional code

Runtime flags

Multiple driver support

Dual WebDriver testing

Dual WebDriver and AppiumDriver testing

Parallel testing

Suite XML file

Parallel properties method

Common setup

Summary

Designing a Selenium Grid

Introduction

Virtual grids

Grid structure

Single browser nodes

Multibrowser nodes

Single mobile device nodes

Multimobile/browser nodes

Selenium driver class – WebDriver versus RemoteWebDriver

The setDriver method for browser

The setDriver method for mobile

Overloaded setDriver method for browser

Switching from local to remote driver

Suite parameters

JVM argument

Default global variables

Processing runtime parameters

Selenium standalone server and client drivers

Local use of drivers

Remote use of drivers

Selenium standalone server and browser driver command-line options

Selenium hub

Selenium hub JSON configuration file

Selenium nodes

Selenium node JSON configuration file

Appium server and mobile simulator/emulator command-line options

Appium nodes

Appium node JSON configuration file

Selenium Grid console

Directing traffic to Selenium nodes

Multiple nodes of the same platform and version

Directing traffic using desired capabilities

Maintenance of the Selenium Grid

Summary

Third-Party Tools and Plugins

Introduction

IntelliJ IDEA Selenium plugin

Sample project files

Generating element locators

Wrap-up on Selenium Plugin

TestNG results in IntelliJ and Jenkins

IntelliJ TestNG results

Jenkins TestNG results

HTML Publisher Plugin

Installation

BrowserMob Proxy Plugin

Getting started

ExtentReports Reporter API class

ExtentHTMLReporter

Dashboard page

Categories page

Tests page

Code sample

Sauce Labs Test Cloud services

Sauce Labs Test Cloud features

Browser and mobile platforms

Driver code changes

Dashboard

SauceConnect tunnel

TestObject Real Device Cloud

Jenkins plugin

Advantages and disadvantages of using in-house versus third-party grids

Summary

Working Selenium WebDriver Framework Samples

Introduction

Selenium driver and DataProvider classes

CreateDriver.java

JSONDataProvider class

Selenium utility classes

BrowserUtils.java

Global_VARS.java

TestNG_ConsoleRunner.java

selenium.properties

ExtentReports classes

ExtentTestNGIReporterListener.java

extent-config.xml

Browser page object base and subclasses

PassionTeaCoBasePO.java

PassionTeaCoWelcomePO.java

Browser test class and data files

PassionTeaCoTest.java

PassionTeaCo.json

Browser Suite XML and Maven Pom XML files

PassionTeaCo.xml

pom.xml file

Summary

累计评论(0条) 0个书友正在讨论这本书 发表评论

发表评论

发表评论,分享你的想法吧!

买过这本书的人还买过

读了这本书的人还在读

回顶部