Developers and Selenium IDE: Record and playback naysayers no more
Why should developers care about using record and playback tools such as Selenium IDE? Despite the stigma around using it for QA test automation, let’s have a look at its uses, why you should care about it, and how it can help you shift left.
Developers should never seriously consider using record and playback tools like Selenium IDE for their QA test automation, right?
Wrong! And in fact, with the release of the updated version of the open source project, this opinion is changing–and fast.
Yes, there’s long been a stigma associated with record and playback tools vs. the scripted QA automation tools like Selenium Webdriver, Cypress, and WebdriverIO. And, it makes a lot of sense given that record and playback tools often suffer from a number of issues, including, but not limited to):
- Lack of cross-browser support
- Brittle tests
- No easy way to wait for the app under test
- No conditional logic
- No way for one test script to call another
- No way to embed code into recorded scripts
- No way to edit scripts once recorded
- No script debugger
- No way to run scripts in parallel
- No way to run tests from Continuous Integration build scripts
- No way to integrate with source code control systems
- No plugins to extend the functionality
- No way to do visual UI testing
- Poor support for responsive web
- No way to quickly diagnose front-end bugs
- No way to export tests to languages like Java
- No way to have data-driven tests
But, after Selenium IDE went end-of-life a couple of years ago (due to the fact that Firefox 55 broke the integration point that Selenium IDE depended on to record and playback tests), two full-time engineers at Applitools approached the Selenium open source community to help. And, with the revamp of the code–now freely available on GitHub under an Apache 2.0 license–Selenium IDE is back and more powerful than ever.
But, why should developers care?
First off, “Shift Left” initiatives means that more and more developers are required to test their own apps. In theory, this makes sense: the earlier a bug is found in the dev lifecycle, the easier it is to fix. In practice, developers are already busy and testing just adds to that workload.
Record and playback tools, like Selenium IDE, are an easy way for developers to shift left, without getting bogged down in writing and maintaining test scripts — a full-time job in itself.
Out of the many record and replay tools out there, why choose Selenium IDE? It’s proven, and perhaps the most-used record and replay tool. It’s free. And it can be installed in seconds as a Google Chrome Extension and Firefox Add-on.
There are several reasons why developers should get excited about the new, revamped version of Selenium IDE. Selenium IDE can run its tests on Selenium WebDriver servers using the new command line test runner, called SIDE Runner. SIDE Runner blends the elements of Selenium IDE and Selenium Webdriver by taking a Selenium IDE script, saved as a .side file, and runs that using browser drivers should as ChromeDriver, EdgeDriver, Firefox’s geckodriver, IEDriver, and SafariDriver.
Because SIDE Runner is called from the command line, developers can easily fit it into CI build scripts, so long as the CI server can call selenium-ide-runner and upload the .side file ( test script) as a build artifact. This means that Selenium IDE can be better integrated into the DevOps toolchain, and the scripts created by less-technical QA team members — including business analysts — can now be run with every build.
Additionally, Selenium IDE tests are brittle no more. Brittle tests have been an issue for functional tests for years — whether you record them or code them by hand. A huge contributor to this problem has been object locators. These are how your QA automation tool identifies which field to fill, or which button to click.
Since developers are under the gun to consistently release new features, their UI code is constantly changing (which also causes the object locators to change as well). Selenium IDE now fixes that issue by capturing multiple object locators when a developer records a script. During playback, if Selenium IDE can’t find one locator, it tries each of the other locators until it finds one that works. This means a test will fail only if none of the locators work.
The new Selenium IDE also now supports third-party plugins to extend its functionality. Anyone can learn how to build their own Selenium IDE plugin and, just think of all the things a development team’s plugin could have Selenium IDE do—upload scripts to a functional testing cloud, a load testing cloud, or a production application monitoring service.
Speaking of new plugins, Applitools built a Selenium IDE plugin to enable AI-powered visual validations on Selenium IDE. Visual AI will literally “look” at a web app the same way a human does (ignoring minor differences) to remediate fake bugs that are so frustrating to deal with. When a developer uses Applitools for Selenium IDE, they can visually test webpages on Applitools Visual Grid. This cloud-based testing service has over 100 combinations of browsers, emulated devices, and viewport sizes to ensure thorough visual testing on all web apps.
Additionally, every Selenium IDE script run with the Visual Grid can be analyzed with root cause analysis to view the relevant DOM and CSS diffs. This, however, doesn’t show all DOM and CSS diffs — just the handful that are most likely to have caused a visual bug, which makes debugging visual bugs go much faster.
Based on the top new features explained above, Selenium IDE is once again back in the consideration for the software development tooling mix. One of the broader trends in IT is to make life simpler for technical professionals and Selenium IDE does just that. In fact, the revamped record and playback tool addresses each of the issues addressed at the beginning of the post (regarding the shortcomings of record and playback tools), except for two things – there still isn’t a way to export tests to languages like Java, and there is no solution (yet) to have data-driven tests.
To go even deeper and perhaps pick a starting place, there is a great tutorial on Selenium IDE written by a former QA manager (Raja Rao) who’s been using Selenium Webdriver for over a decade.