Automated Testing: Using Selenium at Salesforce
Automated software testing can execute routine, monotonous test cases for you, freeing up your testing resources to concentrate on more interesting cases in your application. At Salesforce, we use the Selenium open-source project for the UI-based testing of our applications.
Testing is an important part of releasing quality software. Automated software testing can execute those routine, monotonous cases for you, freeing up your testing resources to concentrate on more interesting cases in your application. As part of a well-constructed automated test pyramid, you want to have some level of UI-based automated tests. For web applications, that means automating the browser.
There are a number of tools you can use to automate testing of the browser. Here at salesforce.com, we use the open-source Selenium project to execute over 40,000 test cases against the features of the Salesforce application. We run these tests as part of our continuous integration build infrastructure, and thanks to Selenium, we are able to execute them on a variety of browsers with no modifications to the actual automation code.Also, since the Selenium library is open-source, we are able to fix issues with it as we find them, and submit them back upstream to the project in order to benefit the entire Selenium community.
Selenium has been around since being started by Jason Huggins and others at ThoughtWorks in 2004. Selenium gives us the ability to run the same tests using many different browsers, including Internet Explorer, Firefox, Chrome, Safari, and Opera. It also supports writing tests in many different client languages, like Java, Ruby, Python, and the .NET languages.
In 2009, the Selenium project merged with the WebDriver project, and in 2010, Selenium 2.0 was released, which featured the Selenium WebDriver API. Subsequent projects have used this API as the basis for creating test libraries for mobile Safari, Chrome on Android devices, and even native applications on mobile platforms. One great thing about this API is that teams within Salesforce can use a single test to automate our applications on most desktop browsers, as well as many of the current mobile browsers.
Another great thing about the WebDriver API is that it has been submitted to the World Wide Web Consortium (W3C) for inclusion as a candidate recommendation for browser testing. Since its inclusion in that process, the project has started to see web browser vendors begin to supply their own implementations of the WebDriver API. Both Opera and Chrome provide implementations of WebDriver; Mozilla’s implementation, which works for both desktop Firefox and the new mobile Firefox OS, will be made broadly available very soon. For Salesforce, that means the tools on which we base our in-browser tests are as stable and reliable as possible, because they’re built by the people who know those browsers best – the browser vendors.
The Selenium community is vibrant and active, with tens of thousands of users worldwide. Because of our widespread use of Selenium within the company, salesforce.com is proud to be a sponsor of the third annual Selenium Conference in Boston, June 10-12, 2013. In addition to being a sponsor, there are several salesforce.com employees who will be presenting at this conference. David Louvton and Amool Gupta will be presenting a talk titled “Scaling Selenium: The Selenium Infrastructure at Salesforce,” which will discuss how we are able to execute our large library of test cases on a wide variety of platforms, using our method of continuously provisioning and destroying instances of virtual machines running our Selenium tests. Luke Inman-Semerau’s talk is titled “Driving iOS MobileSafari.app,” and will show how to use the WebDriver API to driver the iOS mobile Safari application to execute tests of web pages. Finally, I will be presenting a talk whimsically titled “The Internet Explorer Driver Revisited: The Quickening.” My talk covers improvements we have made in Selenium’s driver for Internet Explorer over the last year.
If you’re already planning to come to the conference, please say hello. If you haven’t been able to get your conference pass, as the conference has sold out, videos of these presentations should be available online within a few weeks of the conference. As you’re investing in your testing of your website, you should consider Selenium as your solution for your browser-driven, UI-based tests.