Book Image

Enhanced Test Automation with WebdriverIO

By : Paul M. Grossman, Larry C. Goddard
Book Image

Enhanced Test Automation with WebdriverIO

By: Paul M. Grossman, Larry C. Goddard

Overview of this book

This book helps you embark on a comprehensive journey to master the art of WebdriverIO automation, from installation through to advanced framework development. You’ll start by following step-by-step instructions on installing WebdriverIO, configuring Node packages, and creating a simple test. Here you’ll gain an understanding of the mechanics while also learning to add reporting and screen captures to your test results to enhance your test case documentation. In the next set of chapters, you’ll delve into the intricacies of configuring and developing robust method wrappers, a crucial skill for supporting multiple test suites. The book goes beyond the basics, exploring testing techniques tailored for Jenkins as well as LambdaTest cloud environments. As you progress, you’ll gain a deep understanding of both TypeScript and JavaScript languages and acquire versatile coding skills. By the end of this book, you’ll have developed the expertise to construct a sophisticated test automation framework capable of executing an entire suite of tests using WebdriverIO in either TypeScript or JavaScript, as well as excel in your test automation endeavors and deliver reliable, efficient testing solutions.
Table of Contents (20 chapters)
16
Epilogue
Appendix: The Ultimate Guide to TypeScript Error Messages, Causes, and Solutions

Configuring Allure reporting

If you did not set Allure as a reporter previously, it can be done manually. This is a two-step process: installation and configuration. If you did set Allure, skip to step 2:

  1. To install Allure, type the following:
    > yarn add @wdio/allure-reporter

    This will install Allure as a devDependancies. We can verify the package is added to the package.json file.

Figure 12.1 – Allure reporter dependency is added to package.json

Figure 12.1 – Allure reporter dependency is added to package.json

  1. The Allure package is added to the dev dependencies. Next, the output directories for the HTML report and screen captures must be configured in wdio.config.ts:
Figure 12.2 – Adding Allure configuration to the wdio.config.ts file

Figure 12.2 – Adding Allure configuration to the wdio.config.ts file

In the wdio.config.ts file, outputDir directs where the HTML files and screen captures are to be stored. Let’s use allure-results. Now run the test again:

> yarn wdio

This will launch the example.e2e.ts test...