Exploring Robot-ic QA Automation for Salesforce (Part 2 )
Project Setup, Create/Manage QA orgs
Hello folks, Welcome back to the 2nd part of this blog series on ‘Exploring Robot-ic QA Automation for Salesforce’ in which we are going to learn about how to Project Setup, Create/ Manage scratch Orgs.
Did you miss out on anything from Part 1? don’t worry, click here to get caught up.
Following are the detailed instructions to set up/ create a new Project structure.
- Create New Project Structure:
We’ll go step by step to create Project Structure from scratch level.
- Create a Folder with Project Name (E.g ConcretioTestFramework)
- Go to VS Code & Open the Folder
- Open the New Terminal & make sure that terminal is pointing out your project folder location.
- Run below command to verify Cumulus project is already setup or not
cci project info
The output of the command should be the same as shown in Snapshot.
- Now, run the command: git init to initialize Git repository to your project folder.
The output of the command should be the same as shown in Snapshot below.
- In this step, We’ll initialize the project as a Cumulus Project. To initialize the Cumulus Project run the following command: cci project init
- After hitting the above command, It will prompt some questions on your CLI as a General information of your project.
- Enter Your Project Name: “Enter your Project Name here”
- Package Name: “Enter your package name OR hit enter if, you’re not sure (it will pick default name)”
- Is this a managed package project?: “Press y if it is managed package else press N”
- On hitting y, It will ask you to enter Package Namespace: “give a package Namespace OR hit enter for default”
- Salesforce API Version: “Enter API version number or hit enter to continue with the default”
- Source format: “You have 2 options to choose, 1. Sfdx , 2. Mdapi” (continue with sfdx if you’re not sure)
- Are you extending another CumulusCI project such as NPSP or EDA?: “Press N”
- Git Configuration: “ask your Project lead which branch to set default”
- Feature Branch Prefix: “ask your Project lead”
- Beta Tag Prefix: “ask your Project lead”
- Release Tag Prefix: “ask your Project lead”
- Apex Tests Configuration: “configure as per requirement or choose default”
After answering all the above questions, your CLI will prompt with a message saying:
“Your project is now initialized for use with CumulusCI”
OUTPUT on CLI:
Project Structure Snapshot: https://prnt.sc/13oyv23
- (Optional Step) If You want to allow CumulusCI to work with your repositories in GitHub, connect GitHub as a service in cci using following commands.
Check if GitHub is already listed as cci service: cci service list
Output on CLI:
First, create a new personal access token with both repo and gist scopes specified. (Scopes appear as checkboxes when creating the personal access token in GitHub.) Copy the access token to use as the password when configuring the GitHub service.
Next, run the following command and provide your GitHub Username and access token as the password:
cci service connect github
Output on CLI:
TADA!! You’ve successfully created Project Structure. In the Next section, We’re about to focus on managing and creating the Scratch Org using the cci command
- Create/ Manage Scratch Org:
Here, We’ll be using CumulusCI’s predefined Org configurations to create scratch org. In order to work with Test Framework, use the following commands:
Note: Make sure to run all commands inside Project Folder and your authorization for the DevHub for Project because CumulusCI uses DevHub org configured as the defaultdevhubusername in sfdx.
- First check, If predefined org is exist in your project & make sure If, qa org is exist list
cmd: cci org list
- Create scratch org using qa Org configurations:
cmd: cci org info qa (This command will create one scratch Org using QA Org’s configuration, Check same using 1st step command)
- Using this command, You can set your Org to default to avoid passing CLI arguments every time you run the test. (Optional step)
cmd: cci flow run qa_org –org qa
Above CumulusCI commands are higher-level introductions that are useful in automating the Salesforce platform. For more commands visit here.
Finally, we’re done with Project Setup. Now, all you need is, bit more patience to see the most awaited challenge of How to write a Test Script in Robot Framework. (will be covered in part 3).
To learn more about Exploring Robot-ic QA Automation for Salesforce. We have divided this blog into three parts click here to learn on ‘Introduction to Framework & Prerequisites Installation‘ 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.