IntegrationQA is excited to present an open source gem, leap_salesforce to enable anyone to get kick started with creating test automation for Salesforce.
Do you currently spend hours manually testing Salesforce for the same items each time before a deployment?
Do you have a Salesforce test automation suite that’s tedious to maintain or costing you lots of money?
Although Salesforce has a lot of out of the box functionality there is often still a lot of customisation that is done to tailor it to the specific needs of a company. This customisation needs testing. Salesforce has an excellent Apex unit testing framework for unit testing custom Apex code. However there is still the need to ensure that the apex code, metadata, process builders work together in an integrated environment.
There are many tools on the market for test automation however leap_salesforce is designed to be open source, well integrated with CI and painless to get started with, extend and maintain.
For the out of the box functionality that Salesforce has, test automation can be generated in a consistent manner. Metadata can also be read to make the common approach to working with test automation more specific.
We’ve built test automation suites for Salesforce at a variety of clients. We’ve tried a number of different approaches and experienced frustration on the way. We are always trying to improve our process and therefore want to make an open source library so others can learn and share too. It makes sense to share as Salesforce has more than 3.5 million subscribers.
We found we could reuse our generic assets and knowledge from one client in another to get something up and going rapidly. What we are introducing is an open source library for bootstrapping a comprehensive test automation solution. This will enable faster feedback on changes, verification of deployments and aims to integrate seamlessly with the new Gitlab Salesforce CI / CD pipeline template.
Inspiration came partly from EasyRepro that made baseline code for testing D365 (a Microsoft CRM similar to Salesforce) though we want to do something that is more dynamic to one’s configuration using the metadata API.
What it includes
The code currently:
- Makes Creation, Reading, Updating, and Deletion (CRUD) of data easy through classes that wrap around the API.
- Creation of various data variation intuitive using Factory Bot which beautifully handles defaults, traits, associated records and after steps.
- Reads metadata ensuring items such as picklists and fields limits remain as expected.
It has an executable guiding one to set up a Salesforce OAuth app, enter credentials and then see a suite be generated for their instance within minutes.
Afterwards, it describes how things are pieced together and how it can be utilised to create tests to verify their business process.
You can see an asciinema recording of this building a repository from scratch here.
It is open source and is hoped that the solution will grow over time to include things like automatic generation of page objects for UI testing as well.