Salesforce Automation Testing with Selenium

Salesforce Automation Testing with Selenium

Introduction:

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:

There are times when we try to access a website and notice that some of the banners/images/GIFs are not loading. However, when we check the same site on a different browser, it would all appear fine. Reason being that all the browser vendors follow Open Web Standards, but they offer HTML, CSS, and JavaScript in unique ways. This implies that custom built Salesforce websites may not look the same across different browsers. Such issues can be discovered by performing Cross Browser testing. 

There are four layers in Selenium architecture, namely, Selenium Client Library, JSON Wire Protocol, Browser Drivers and Real Browsers. Selenium bindings are supported by multiple programing languages, and together they form the Selenium client layer where test scripts are written. JavaScript Object Notation (JSON) wire protocol helps to transfer test script information to the specific browser drivers. Selenium can communicate with multiple browser drivers providing seamless cross browser testing capabilities. Browser vendors create browser drivers that communicate with real browsers over HTTP to keep the internal logic confidential. Selenium ensures to identify issues pertaining to custom components and user interfaces on different web browsers whenever new builds are released from Salesforce application development teams.

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.

salesforce

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.

salesforce

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.

Conclusion

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.

Leave a Comment

Your email address will not be published. Required fields are marked *

Recent Posts

salesforce experience cloud features
Salesforce Experience Cloud Features & Its Benefits
why should you choose salesforce revenue cloud and cpq
Why Should You Choose Salesforce Revenue Cloud & CPQ!
5 most important salesforce marketing cloud features
5 Most Important Salesforce Marketing Cloud Features
absyz your trusted salesforce managed services provider
ABSYZ: Your Trusted Salesforce Managed Services Provider
servicemax field service management
ServiceMax Field Service Management
Scroll to Top