This is first post of multi-series article on using Selenium with Salesforce for Automation testing. Testing has always been integral part of any software development life cycle and Salesforce has already taken it to next level by making mandatory to have 75% of code coverage before any code deployment. These apex test classes, however has its limitations where we can only test Apex code written. I have seen most of Salesforce project ending with manual testing. Audience for this series is not only developer but Salesforce admin and of course manual testers as well and please feel free to drop comment throughout this series if I left any area or topic uncleared.
What is Selenium
Selenium is a portable software testing framework for web applications. Selenium provides a record/playback tool for authoring tests without learning a test scripting language (Selenium IDE). It also provides a test domain-specific language (Selenese) to write tests in a number of popular programming languages, including Java, C#, Groovy, Perl, PHP, Python and Ruby. The tests can then be run against most modern web browsers like firefox, Chrome, Internet explorer. Selenium deploys on Windows, Linux and Macintosh platforms.
How Selenium can benefit me
Its not only Automation testing where you can leverage selenium. You can use this tool to move some manual changes from one Salesforce organization to another, to avoid preparing test data every time when sand box is refreshed and so on.. usability is endless.
- Download and install Firefox browser
- Add Selenium IDE Plugin for Firefox from official Selenium download website
Once Selenium plugin is installed in Firefox we can launch Selenium IDE and it will look like below screen
As you can see in above image, red circle icon is used to record step and once it is recorded, can be re-run using green symbol. Complete step are explained in Video tutorial.
Error : Selenium element not found
Chances are very high, where we will receive error in selenium script about “Element not found”. This is because if some content is loaded via Ajax, Selenium doesnt know that it needs to wait. There are many ways to handle it, but for me “waitForElementPresent” works in most cases.
Selenium Test Case code snippet
Leave a Reply to Clueless Cancel reply