WebdriverIO and Sauce Labs for Mobile Ecosystem

By: Daniel Guzman – GlobalNow Senior QA Automation Engineer

I previously shared my experience of integrating WebdriverIO and Sauce Labs for a new NodeJS web test framework. I’ve now implemented the same framework for the mobile portion of the project, and as promised in my last blog, below is a brief summary of my findings and experience:


Why use the same tools?

One of the most important considerations when architecting web and mobile solutions is to reuse the same stack of tools as much as possible. Although often web apps/tools don’t easily integrate with mobile solutions, in this case we were successful which resulted in significant time savings.

In addition to saving time, I had two other reasons for reusing the code from my web framework. First, I’m often frustrated by projects that do not follow any kind of standard architecture. A standard framework helps programmers from different projects get up to speed quickly for enhancement development and ongoing application support. Second reason is that by using a standard test framework across projects, I am better able to support hybrid test cases: to cover scenarios where I need to perform some action in the mobile app, then check or do some other action on web side, or the other way around.

Cucumber and Chai!

Using Behavior Driven (BDD) Cucumber and Chai frameworks was a natural fit for Appium and Sauce Labs. BDD is something I learned to appreciate quite some time ago. It’s not only an approach that we developers like, but also Business Analysts and supporting team members. When I started my current project, most of test cases were already written in BDD syntax, so the transition to transform text requirements to code instructions was an easy and groovy experience.

Appium on Sauce Labs (simulator)

Here is a brief summary of how Appium works with Sauce Labs: Sauce Labs launches a MAC environment, then launches the simulator that you specified previously, then starts the Appium server. Finally it launches the device you specified. That’s it!, Your test commands will then be executed. This is basically the same behavior Sauce Labs uses to launch the Selenium server, which is pretty handy, since WebdriverIO doesn’t start up any of these services automatically.

WebdriverIO

Lets talk about code. The biggest concern I had regarding code was how to interact with Mobile elements, would it be the same as the Web? Well guess what? You can reuse commands that are shared between platforms, for instance, .getText() method for Mobile is exactly the same as you would use for a Web environment. Plus WebdriverIO has implemented lots of commands that are specific for mobile interactions. One great example is the .hideDeviceKeyboard() command, used to hide the keyboard while still interacting with Mobile app elements.

Recap

It was a fun ride to get this entire stack playing together successfully. The above is a successful example that may encourage you to automate your own suite of test cases using these great tools.

Don’t hesitate to ping us if need help in any part of your set up process.
Happy Mobile Testing!

Daniel