Concretio

View Original

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.

Hurray!!! Now, it’s time to install all the necessary prerequisites to set up the project.

Prerequisites:

PYTHON:

  • 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)

  1. %USERPROFILE%\AppData\Roaming\Python\Python39\Scripts

  2. %USERPROFILE%\AppData\Roaming\Python\Python39\

  3. %USERPROFILE%\.local\bin

  1.       Run this Command on your CLI: python --version

PIP:

  • Pip is installed by default with python version > 3.X

  • To check if, PIP is installed on your machine:

  1. Run this Command on your CLI: pip --version (Preferred version: latest or 21.1.2)

  • To upgrade the PIP with the latest version:

  1. Run this Command on your CLI: python -m pip install --upgrade pip

PIPX:

In order to Install CumulusCI, PIPX should be installed on your machine

  • To install PIPX:

  1. Run this Command on your CLI: python -m pip install --user pipx

  • To check if, PIPX is installed on your machine:

  1. 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.

CumulusCI:

  • To install CumulusCI:

  1. Run this Command on your CLI: pipx install cumulusci

  • To check if, CumulusCI is installed on your machine:

  1. Run this Command on your CLI: CCI version

  • To upgrade the CumulusCI with the latest version,

  1. Run this Command on your CLI: pipx upgrade cumulusci

Salesforce CLI:

Use this link to install and verify SF CLI on your machine:

VSCode:

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:

  1. Salesforce Extension Pack

  2. Python

  3. Robot Framework Intellisense

  4. 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 are always pleased to address any inquiries you may have.

Thanks to our Salesforce Consultant Divy muni for this amazing blog post written with detailed information.

Reference Links:

  • https://cumulusci.readthedocs.io/en/stable/index.html#

  • https://partners.salesforce.com/pdx/s/learn/article/cumulusci-partner-fundamentals-MCXMA5YR4RGFHOTN6WOXZNVMDMZU?language=en_US

  • https://robotframework.org/

  • https://developer.salesforce.com/docs/atlas.en-us.sfdx_setup.meta/sfdx_setup/sfdx_setup_install_cli.htm#sfdx_setup_install_cli_windows