Selenium framework design in data-driven testing build data-driven test frameworks using Selenium WebDriver, AppiumDriver, Java, and TestNG
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...
Otros Autores: | |
---|---|
Formato: | Libro electrónico |
Idioma: | Inglés |
Publicado: |
Birmingham, England :
Packt Publishing
2018.
|
Edición: | 1st edition |
Materias: | |
Ver en Biblioteca Universitat Ramon Llull: | https://discovery.url.edu/permalink/34CSUC_URL/1im36ta/alma991009631662006719 |
Tabla de Contenidos:
- Cover
- Title Page
- Copyright and Credits
- Dedication
- Packt Upsell
- Contributors
- Table of Contents
- Preface
- Chapter 1: 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
- Chapter 2: 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.
- Chapter 3: 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
- Chapter 4: 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
- Chapter 5: 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
- Chapter 6: 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
- Chapter 7: 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
- Chapter 8: 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
- Chapter 9: 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
- Chapter 10: 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
- Index.