Open-Sourcing Soda: A Simple Object Driven Test Automation Framework
- Jeremy Hodges & James Pavlic
- 4 min read
Soda, or simple object driven automation, framework is now open-source. Get started now at https://github.com/Ally-Financial/soda/
Introducing Soda
Ally is excited to announce we have open-sourced an internally developed test automation framework we call “Soda.” Originally developed in early 2016, Soda provides a simple, object-driven testing and automation framework that works across native Android, iOS, and web systems. Soda was originally developed within Ally’s native mobile development team to provide greater and simpler automated test coverage across both iOS and Android apps.
Not only is Soda a feature-rich CLI app, it’s also an importable Node.js module and complete testing IDE. Tests can be created, edited, run and maintained through JSON files and the CLI, or visually through our Soda Visual Editor.
How It Works
Soda works by creating a consistent interface to work with, regardless of the platform you are testing on. Each supported platform has a Soda framework that implements the contract — utilizing the native APIs to get a representation of the screen back and create a normalized DOM tree. The elements you define in your scripts are checked against the returned DOM. This means the framework is actually doing very little, and Soda can harness the power of Node.js to do the heavy lifting. If you choose to interact with an element, Soda sends a message to the framework to tap, swipe, click, etc. By doing very little with the framework itself, Soda has abstracted away all the code needed to work with the framework. Additionally, it only uses a handful of methods to work with the framework. Meaning, if it all changed tomorrow, updating Soda to work with the new framework is a simple and quick task.
More Than Just Testing
Because Soda is a complete automation framework, it can be used for much more than testing. For nearly five years, Ally has been using Soda to automate the monitoring of our advertised interest rates across Ally.com to self-audit, ensuring we are always consistently displaying the current interest rates for our products to all customers. Soda even provides the ability to capture a screenshot, so you can have full confidence in and auditability of the returned results.
No SDK Requirement or Recompiling
We believe that testing should be completely independent of your app. Using Soda means you’re testing your app as it is. We use the native tools provided by iOS, Android, and the web. Soda implements a “framework” for each system it needs to interact with. This allows the Soda JSON tests to be written consistently across device types or even native operating systems.
Supported Frameworks
As of the open-source release, Soda already has nine mature frameworks built and production- ready. We look forward to seeing what additional frameworks might be added to Soda by the open-source community. Soda currently supports the following frameworks:
Native Android
Native iOS
Selenium
Puppeteer
Perfecto Mobile
Windows
HTTP/Service
REST
XML
Writing Your First Soda Test
Soda uses JSON to write tests. It’s simple, serializable, and less prone to error. In addition to utilizing JSON, Soda uses its own selector engine, much like CSS, and selectors are the same across platforms.
Here’s an example of Soda’s syntax. See how simple it is?
Next Steps — iOS Development Bridge Support
Rather than reinventing the wheel for interacting with native iOS simulators and devices, we chose to use Facebook’s WebDriverAgent. In mid 2019, Facebook abandoned support for WebDriveAgent and archived the project. Facebook is now using and supporting idb for automating iOS Simulators and Devices.
Because support for WebDriveAgent has been abandoned, work on implementing idb is well underway in the develop branch. If you are an iOS developer, this would be a great way to begin contributing to Soda. To begin working on this framework, you can go to src/SodaCore/frameworks.
Contribute to Soda
We are excited to see what the community does with Soda, and we look forward to your contributions. We have put together a contribution guide available here. Start coding and start testing!
Interested in joining Ally's team of talented technologists to make a difference for our customers and communities? Check outAlly Careersto learn more.