In this article, I will make a comparison between using Selenium and Rapise for automated testing of the Salesforce Lightning application. The main keynote will be on how easy and how fast we can develop tests for Salesforce.
Salesforce: Salesforce is an online solution for customer relationship management, or CRM. It gives all your departments — marketing, sales, commerce, and service — a shared view of your customers with one integrated CRM platform.
Rapise: This is a tool for developing automated tests developed by Inflectra used for testing web, mobile, and desktop applications. Also, it provides a library for testing Salesforce.
Selenium: Is a well-known and widely used free framework for developing web GUI automated tests.
In the following examples, I will show you how the same actions are completed with Rapise, and Selenium. All of the examples with Selenium are written in Java.
Creating a test in Rapise
Salesforce is a completely web-based application and we use a browser to access the user interface. Most of the Salesforce user interface is tested using a standard browser library that is included in Rapise for web testing. In addition, there are special controls inside Salesforce.com that Rapise has specialized support for. For that reason, you’ll also see the DomSalesforce library added to your test as well as the browser one. This DomSalesforce library adds additional rules that identify certain Salesforce.com objects (e.g. the main Grid) to make testing easier.
With the including of this library, we will get more functions for easy Salesforce testing. Using DomSalesforce we can test both: Salesforce Lightning and Salesforce Classic themes.
In this article I will show how to test Grid and ListBox:
- Almost all of the data represented for the users is in tables (grids). In Salesforce all IDs are variable so we can’t select data from the tables easy. DomSalesforce provides 7 functions for testing these grids:
- DoClickCell() – Clicks the specified cell when you specify the x-index, y-index, the type of click (left-click, right-click, etc.)
- DoClickText() – Clicks on a specific text inside the grid
- GetCell() – Gets the text of the specified cell
- GetColumnCount() – Gets the number of columns in grid
- GetColumnName() – Gets the caption of a column
- GetRowCount() – Gets the number of rows in grid
With this command, we will click on the Leads name Test Testovski from the table, and we will be redirected to the leads detailed info. If there is more than one name: Test Testovski in the table, this command will select the first found result (index 0).
1. Selecting a single lead from the table.
This function will return an integer with a total number of data in the table. In our case, the result will be: 4.
- Even if the ListBox looks like a normal drop-down menu, it is a list. Because they don’t have any IDs some of the XPATHs for selecting a single choice can be very long, depending on the place where the element is located on the interface. DomSalesforce provides a single function for simple selecting of the provided options by naming the selection or the index where the options are listed in the list.
Example 3: Selecting the option Leads from the search bar:
2.Selecting an option from the ListBox
All test steps in a single test in Rapise can be recorded with an implemented recording tool. The recorded HTML objects are categorized well by pages, XPATHs are as short as possible and we can also see all available functions that can be executed against the specific object.
3. Rapise object tree
Creating a test in Selenium
Creating an automated test for testing Salesforce is more complicated with Selenium. We don’t have a test recorder for our objects and there is no library for testing Salesforce and its complex elements. All of the test code should be written by us and sometimes it can be very complex.
Example 4: Clicking on the leads name Test Testovski
Testing Salesforce is much faster and easier using the Rapise and their DomSalesforce library. Actions for grids and listbox that are used most often are included in this library. Additionally, we can record our test scenario and capture all HTML objects from the interface.
We can also test Salesforce with Selenium framework. The plus side is that we can run these tests on different operating systems and use different programming languages.