Exploring Robot-ic QA Automation for Salesforce (Part 1)
Introduction to Framework & Prerequisites Installation
After struggling (lack of support for SF, massive costs, dependencies, etc) with so many Automation tools in the market, we as Team Concretio, find out the right solution which is completely open-source and also recommended by the official Salesforce team.
Do not hurry & sit tight with a cup of Coffee or Tea to understand the Salesforce Test Framework. 😄
The solution is the integration of two Frameworks i.e. CumulusCI and Robot-Framework along with various libraries (External, Standard & other). It offers two ways to automate browser tests either via 1. API or 2. UI, and in both cases, We’ll use text keywords (written in libraries to automate Test Scenarios/Cases, which almost ease the automation practice by 70-75% and reduce the time complexity taken by SDET to automate the Salesforce platform. It helps in achieving the desired productivity with fewer resources.
Higher level introduction of Frameworks:
Let’s start with CumulusCI – It is a powerful toolset to manage the Salesforce platform by automating org setup, testing, and deployment. It also helps developers to build good applications but here, we’ll cover the Testing part only.
Robot-Framework – It is Test Automation Framework and is written in the Python programming language for acceptance testing, acceptance test-driven development.
It approaches various styles (Keyword-driven, Behavioral-driven, Data-driven) to automate Test Scenario/ Cases. It uses a .robot file extension and that is where we define our test cases, custom keywords & variables, etc.
Libraries used in Framework:
- CumulusCI comes in bundled with all needed third-party libraries (useful to automate SF platform) like SeleniumLibrary, Selenium2Library, RequestLibrary, SalesforceLibrary, PageObjectsLibrary, FakerLibrary, etc. Inside the CumulusCILibarary strong keywords have been written to automate the SF platform but if you still need to import an external library as per project requirement. Please go through this link: External, Standard & other.
- Documentation of the CumulusCI & Salesforce Keywords can be downloaded from here: CumulusCI & Salesforce Keyword documentation
Hurray!!! Now, it’s time to install all the necessary prerequisites to set up the project.
- Python version 3.X.X should be installed in your machine (Preferred version: 3.9.X)
- Path to the Python Script folder and Python Folder should be added to environment variables (System & User Variable)
- Download & Install Python from here: https://www.python.org/downloads/
- To check if, Python is installed on your machine
- Run this Command on your CLI: python –version
- Pip is installed by default with python version > 3.X
- To check if, PIP is installed on your machine:
- Run this Command on your CLI: pip –version (Preferred version: latest or 21.1.2)
- To upgrade the PIP with the latest version:
- Run this Command on your CLI: python -m pip install –upgrade pip
In order to Install CumulusCI, PIPX should be installed on your machine
- To install PIPX:
- Run this Command on your CLI: python -m pip install –user pipx
- To check if, PIPX is installed on your machine:
- Run this Command on your CLI: pipx –version
*If you get an error, such as ‘pipx’ is not recognized as an internal or external command, operable program, or batch file. confirm that your environment variables have been updated.
- To install CumulusCI:
- Run this Command on your CLI: pipx install cumulusci
- To check if, CumulusCI is installed on your machine:
- Run this Command on your CLI: CCI version
- To upgrade the CumulusCI with the latest version,
- Run this Command on your CLI: pipx upgrade cumulusci
⚫ Salesforce CLI:
Use this link to install and verify SF CLI on your machine:
Here, We’re going to develop Robot Framework Project Structure using VSCode as an IDE so that, Following extensions needs to be installed on VSCode:
- Salesforce Extension Pack
- Robot Framework Intellisense
- Robot Framework
All above extensions will provide auto-suggestions of Keywords, Syntaxes, commands, you will be able to easily navigate to definitions, It will provide support to .robot & .resource Files. overall It will provide a unique strength to IDE (VSCode) to write scalable code.
To learn more about Exploring Robot-ic QA Automation for Salesforce. We have divided this blog into three parts click here to learn on ‘Project Setup, Create/Manage QA orgs‘ and ‘Project Structure and example of create contact test case‘. We’re always happy to answer any questions you might have. If you are interested in reading more articles on Salesforce. Check out some of our favorites here.
Thanks to our Salesforce Consultant Divy muni for this amazing blog post written with detailed information.