Accelerate Multi-browser Testing Using Sauce Labs and Webdriver.io
Sauce AI for Test Authoring: Move from purpose to execution in transactions.|xBack to ResourcesBlogPos
Sauce AI for Test Authoring: Move from purpose to execution in transactions.
|
x
Blog
Accelerate Multi-browser Testing Using Sauce Labs and Webdriver.io
Sahas will be presenting & quot; Design Patterns for Scalable Test Automation With Selenium & amp; WebdriverIO & quot; in our adjacent webinar on Wednesday, June 15th at 11:00AM PDT / 2:00PM EDT
There are a lot of webdriver-based testing frameworks out there.Webdriver.iois a comparatively new coolheaded kid on the block. It has enough to differentiate itself and facilitate us to focus on make reliable GUI tests. A few highlighting on what this framework comes with:
Out-of-the-boxES 2015support - leverage all the goodness that ES6/ES2015 offers.
Out-of-the-box promises support - This framework habituate Q.js internally, and every individual command typify a promise. The 2d command will be executed exclusively after the first command promise is decide.
Out-of-the-box Sauce Labs contrabandist service - to run exam on Sauce Labs
Out-of-the-box parallel test contrabandist (wdio) - to run tests across multiple OS/Browser mixture in parallel
A rich set ofAPIsmakes the exam code short and concise
These advantages help organizations centre on their core province — to automate their verification procedure quickly instead of developing and maintaining usance libraries to support automation efforts (more productivity — we all love it).
For autonomous testing across multiple user personas, check out SUSATest — it explores your app like 10 different real users.
Design Pattern
Regardless of the tool of choice, I urge postdate the Page Object pattern for authentic exam. ES 2015 support do it leisurely to achieve that design. Tests will run on multiple platforms base on the configuration:

Step 1: Define the UI Map
The UI map is used to enshroud HTML implementation from consuming Page Objects for easier maintenance.
Since webdriver.io supports ES 2015, we are using the class and getter method to access the elements.

Step 2: Define Page Object APIs
Page Object allow APIs to perform action on the page, and provides access to the current province of the underlying page. In the implementation below, we import the UI map and expose the activeness (APIs) for the test.

Step 3: Define Tests
In this example, we use Mocha (TDD style) for defining the tests, and Chai for assertions. Import the Page Object (using a little dependance injection here) and telephone those APIs to Navigate to Google and Search for an point.

Step 4: Sauce Labs Integration
Create a config file and ply your Sauce Labs credentials:

You can use the Sauce Labs to create the necessary configuration. The final configuration would look like:

Step 5: Run Your Tests
Run this bidding from your tests directory:
node_modules/webdriverio/bin/wdio ./wdio.conf.sauce.js
The tests run inparallel, with results be update mechanically.

Enjoy! This source code is available in myGitHubaccount for reference.Sahas Subramanian (@ sahaswaranamam) is a passionate engineer with experience spanning across DevOps, quality engineering, web development and consulting. He is presently working as a Continuous Delivery and Quality Architect @CDK Global, and shares his thoughts on tech viahttps: //cdinsight.wordpress.com
Automate This With SUSA
Upload your APK or URL. SUSA explores like 10 real users — finds bugs, accessibility violations, and security issues. No scripts needed.
Try SUSA FreeTest Your App Autonomously
Upload your APK or URL. SUSA explores like 10 real users — finds bugs, accessibility violations, and security issues. No scripts.
Try SUSA Free