@rpii/wdio-data-driven
Provides tool for emulating data driven tests in webdriverio. Updated for compatibility with webdriverio version 6. Now hides passwords.
Completely taken from the nightwatch version: https://github.com/rpii/nightwatch-data-driven and adapted for wdio. Supports iteration of data from spreadsheet pages. There are two modes of operation, straight iteration or usage of callbacks functions for asserting on varying conditions. Works with sync mode. Allows the usage of spreadsheets pages as datasets for test iteration.
Installation
npm i @rpii/wdio-data-driven --save
Example 1: Simple usage
-
Create DataDrivenTest instance passing a function representing the body of the test (the Arrange
TestFn
Assert_ functions).
-
Call forCases method with object containing names and data for test cases. Use disabled parameter to deactivate test case(see example).
-
Pass in a spreadsheet with the credentials to be tested.
;;
Example 2: Building and reusing of "test blanks"
- Create DataDrivenTest instance without parameters for our "test blank".
- Call withArrange method passing Arrange function of "test blank".
- Call testFn method passing Action function of "test blank".
- Call withAssert defining the assert for this case.
- Now you can reuse "test blank" calling withAssert and forCases methods with different Assert functions and data in each particular test.
;; // . Create "test blank"let submitLoginForm = ;