Saturday 22 October 2016

Salesforce Automation using Selenium

Salesforce is a Software as a Service (SaaS) application. This application is cloud based and from automation it is simple web based application.

Salesforce comes with an option as Sales cloud, Service cloud or Marketing Cloud. For simplicity of this post we will limit it to Sales cloud (CRM - Customer Relationship Management). This is commonly called as SFDC - Salesforce dot com.

Selenium webdriver is useful to automate, however the application uses iframe and CSS. Hence it is essential to first find out which element properties we will be using.

Salesforce has dynamic elements and hence during automation it is always challenging to identify the correct properties and then checking the modified properties to use them. The Salesforce testing is completely depends on the quality test data. Hence in automation before we run our scripts we need to generate sufficient but quality test data. In addition, we need to remove it after execution is complete.
This way we make sure that each time Selenium script will run, it will get the right data and right elements properties.

We usually run the test data as a part of our scripts to generate the case ids. Once all the required and sufficient test data is generated, scripts will run with the scenarios and validations. After completion of execution the last part of the scripts will have cleaning up activity. This will make sure that we can use the same data generation scripts in future as well.

The driver script is required which will be called by the test runner after initialization. So before we call the driver script to run the business flows we need to place our test data generation scripts. And at the end of each business flow, we need to run the clean up script.

This application is simple and straight forward, however for automation using Selenium the major challenge is its dynamic elements and changing properties. e.g Name of the element present on the page changes as soon as it gets data filled in its other controls. This creates issue for the automation engineer who has created script using static values. The first time execution itself fails and requires to put some logic behind identifying such elements. Here we need to decide which locators we will use and for most of such dynamic controlls the best solution is to take them out in property files.

If the above considerations are already in place then the Selenium webdriver is the best and quickest automation tool for Salesforce Automation.

Keep Automating!


No comments:

Post a Comment