Automating Salesforce Testing with Robot Framework

Robot framework is an open-source automation framework, and it is implemented by Selenium with Python. It is executed by Jython (JVM) and Iron Python (.NET). Robot Framework is an automation framework for acceptance testing and acceptance test-driven development testing.

A Practical Guide on Automating Salesforce testing with Robot Framework

Introduction:

Robot framework is an open-source automation framework, and it is implemented by Selenium with Python. It is executed by Jython (JVM) and Iron Python (.NET).  Robot Framework is an automation framework for acceptance testing and acceptance test-driven development testing.

The Robot framework supports data driven, keyword driven, and table-driven methods

Features:

  1. Robot framework supports advanced keyword driven framework
  2. Dynamic variables are used, and scripts and custom keywords are reusable
  3. It supports test libraries including Selenium
  4. It is an open-source framework
  5. It provides simple and powerful test reports

Pre-requisite for Robot framework:

Python should be installed with Selenium Installation, and then the robot framework and RIDE should be installed with python.

RIDE:

Executing Robot framework with python using “robot” scripts. The scripts are executable in the automation framework system.

RIDE can be open as a windows command as ride.py.

This is the RIDE editor normal view. Here, we can import files like standard & external library, resource files, variables, Scalar variable, list and dictionary using the add import setting option.

Scenario:

Create a new lead record and convert the lead record; then verify the Lead values are mapped with Accounts, Opportunity and Contacts object fields.

Step1:

We can import library files and resource in RIDE using setting option.

Robot Framework
The scripts are executable in the automation framework system

RIDE has standard and external library files; so, we can import as per our requirement.

Resource setting method is used to import extra files like reading data from excel action and any other complex method implementation can be developed a code in python file and import it as a resource file.

Step2: Identify and capturing the Web element.

To identify the web elements through inspect/fire path and update the web elements using the scalar variable method.

Adding a scalar variable with web elements

Robot Framework
To identify the web elements through inspect/fire path and update the web elements using the scalar variable method.

The scalar variable contains web elements of the Lead, Account, Opportunity and Contacts object. Please see the screenshot below:

Robot Framework
The scalar variable contains web elements of the Lead, Account, Opportunity and Contacts object.

We can use this scalar variable in all test cases inside of same test suite.

Test case creation:

We can prepare test document like functionality and test steps, using setting option.

Robot Framework
We can prepare test document like functionality and test steps, using setting option.

Setup and Tear-down:

Tag: Tags are generally more flexible and provide more functionality than documentation, we can tag test cases and run at necessary test execution.

In Robot framework, the test cases are written by two methods:

  1. Work flow test
  2. Data driven test

New User Keyword:

By right clicking test suite, we can create a new user keyword. The keyword should have argument names and clear structure about the test cases.

Below is the example of user keyword method

Salesforce Test Automation
Example of user keyword method

Test Case: By Right clicking the test suite, we can choose the new test case drop down and write the test cases in a tabular syntax method. The test cases are written easily by using this method.

Text view of test cases:

Salesforce Test Automation
Text view of test cases.

Once have completed the test case development, click Save icon on the top window; then, execute the test cases.

Test Execution and Test Results:

After executing the test cases, these three files are generated: Log, Report and XML files. The test results would be very clear and detailed. It generates the compiled report with a step-by-step execution detail.

Among the executed test cases, two test cases passed and other two test cases failed, also the test execution result could be generated in run tab with console

Console window of RIDE

Salesforce Test Automation
Console window of RIDE

Test Log Report:

It is a log report of test execution.

Salesforce Test Automation Framework
It is a log report of test execution.

Failed Test Log Report:

When executing the test cases, if any issues are identified, they are automatically taken screenshot with a detailed description.

Salesforce Test Automation Framework

Test Report:

Robot framework generated detailed reports about test execution with time duration and status %.

Salesforce Test Automation Framework
Robot framework generated detailed reports about test execution with time duration and status %.

Robot framework Advantages:

  1. Less effort to automate the test cases
  2. It supports Continuous Integration and easy integration with other tools
  3. It supports exception handling and test executions are supported by different operating system
  4. Test matrices updated automatically.
  5. Failed test cases can be captured as defect screenshots with detailed descriptions.

Reference link:

http://robotframework.org/robotframework/latest/RobotFrameworkUserGuide.html
https://github.com/robotframework/robotframework

About MST

At MST Solutions our cornerstone is to adapt, engage and create solutions which guarantee the success of our clients. The talent of our team and experiences in varied business verticals gives us an advantage over other competitors.

Recent Articles

Work with us.

Our people aren’t just employees, they are key to the success of our business. We recognize the strengths of each individual and allow them time and resources to further develop those skills, crafting a culture of leaders who are passionate about where they are going within our organization.