Skip to main content
Growing a Salesforce Testing Strategy with Cypress
December 1, 2021 |

Recently at Phase2 a daunting task laid before us. We had taken over a Salesforce initiative that made heavy use of Screen Flows and Lightning Components to facilitate complex user paths. Most of the application’s users accessed the features and records through a Salesforce Digital Experience Site with a custom theme. Further, there was a lot of functionality already baked in and the client had a long backlog of fixes and feature requests. We didn’t want our limited knowledge of the application to cause us to introduce regressions.

Salesforce comes packaged with an automated testing platform that helps to verify functionality and avoid regressions. It works really well for validating data after the functional processes have run. Of course, so much of the success of this application went beyond just getting the right data, it relied equally, on a good frontend user experience.

It was clear we needed to go beyond only verifying we were capturing the right data. We needed to be sure the interface was operating correctly as well. We turned to the Cypress testing platform to help us move swiftly without breaking too much.

Cypress is a testing framework used by software developers to test their code. These tests are written in JavaScript and run natively through a browser, including Chrome and Firefox.

Having used Cypress on other applications we knew it to be a flexible and feature-rich testing framework that we could quickly integrate into our tools and begin coding. And, it being a Node.js application also meant we would have access to existing libraries, like JSForce, for connecting to the Salesforce API.

As we acclimated ourselves to the application we built tests along the way. We would dig into a reported issue and document the user path not only in writing, but in an automated test as well. The automated tests were designed to not only validate the generated data, but also assert the interface and user experience remained functional. 

In a matter of weeks we had a great foundation of tests. We were able to contribute fixes and new features to the project confidently. We continued to build on that foundation and now have a large suite of tests covering the most important user paths.

The tests became a game changer for manual testing as well. Before the tests it could take 30 minutes to set up the records and verify a fix. With the automated tests we could have a new Case, Contact, and User spun up in a matter of seconds. After the automated test run was complete we could access the application using those same records to complete a manual review.

Another benefit came in the form of onboarding new developers and administrators to the project. Instead of handing them a black box of features and flows the tests provided ready made guides. We could point new folks to specific tests to run and review as they began picking up tickets.

If you’d like to introduce Cypress to your Salesforce testing regimen there are existing guides for getting started with the basic setup:

We hope you enjoyed reading the Phase2 blog! Please subscribe below for regular updates and industry insights.

Direct from our brains to your inbox

Jeremy is a hard working, creative and dedicated teammate with a knack for problem solving. He has a collaborative spirit that plays well with experts and novices alike, and is driven to implement solutions that create efficiencies and integrate data across platforms.

Jump back to top