When it comes to cloud-based CRM systems, Salesforce was first of its kind to successfully implement it. Built on its Force.com platform, Salesforce has expanded its coverage of industries and processes over the years. It now serves customers with Marketing Cloud, Service Cloud, Health Cloud, Community Cloud, Commerce Cloud and many more.
Apart from providing standard features and components, Salesforce provides multiple options for customization with its platform development language called APEX. These customizations can add to the complexity of the system. Hence, Salesforce testing becomes as critical as its administration and development. To reduce the risk of Defect/Issue Leakage into the production environments, repeated execution of a strong set of test-suits is necessary.
One of the most popular, open-source tools for Salesforce automation testing is Selenium Web-driver. Selenium offers a wide range of solutions when it comes to web application automation testing. In this article, we will discuss some of its features which provide solutions for Salesforce automation testing.
Cross Browser Testing:
Page Object Design Pattern:
In order to interact with the elements on any Salesforce web based application, we need to identify, store and create action methods that can be performed with those web elements. Clients often orient their web application user interfaces with the changing requirements of their customers. This results in manipulation of elements on the web page. Here, maintenance, code reusability are some aspects that come into picture. To overcome such challenges, Page Object Model (POM) is one of the powerful design patterns that is used across multiple Selenium frameworks.
Page object is an object-oriented class that serves as an interface to a page of the application under test. The test scripts written, use the methods of this page object class while interacting with the elements of that page. This model facilitates in creating test script and page object in different class files keeping the code clean. Whenever UI changes are made on a web page, the code within the respective page object needs to be changed and not the entire test script.
Integration with CI/CD tools:
Salesforce is well known for its jumpstart programs; these are quick and flexible Salesforce implementations. Continuous integration is something that follows a similar philosophy. It is a development practice in which developers are required to frequently commit changes to the source code in a shared repository. Jenkins is one amongst the widely used CI tools. It is an open-source tool written on the Java platform.
By integrating selenium test scripts with Jenkins, test execution can be performed every time prior to a new build being deployed. This is termed as build verification trigger. It is completely automated within Jenkins and is performed to verify if any existing tests are failing due to the new build. Moreover, these tests can also be scheduled to run at specific times. Jenkins also provides multiple plugins to host execution reports. Execution history and test reports can be saved within Jenkins for individual test triggers.
Data Driven Testing:
When we look at Salesforce cloud services, many of them deal with large volumes of data. Within Salesforce there is a tool called Data Loader that is capable of handling half a million records in single session. This tool can perform read, extract and load operations with data present in CSV files.
However, validating these records is a time consuming and tedious activity. To handle such scenarios Selenium offers a data driven testing approach. As most of the web drivers do not support interaction with data files (.csv/ .xlsx), Apache POI plugin (Poor Obfuscation Implementation) is used in selenium frameworks to perform read/ write operations on data files.
This technique allows separation of test data from the test scripts. Results obtained from test execution can be compared with the expected outcomes which are stored in data files itself. Changes in the test scripts can be made without interfering with the test data files.
Over the past few years, Selenium has emerged as one of the powerful open-source automation testing tool. As a language independent tool, Selenium scripts written in Java, Python, C# etc., can be run on multiple operating systems like Windows, MacOS, Linux and so on. Selenium offers various third party drivers and plugins that makes it highly capable of testing complex web based technologies like Salesforce.