About testing in Salesforce 🤔
Last updated
Last updated
Customized features in Salesforce may orchestrate actions in several development/configuration tools: Apex, Flow, Process Builder, Workflow Rules, ... There is no out-of-the-box testing functionality that covers all these tools.
Using Apex test coverage % as a quality KPI may be OK for unit testing Apex. But only if you know what the tests validate and how they do it. In a laissez-faire development model this KPI is not a valid indicator for the quality of the Apex code base.
Apex Test Classes and tests in After Save Flows can validate "behind-the-curtain" transactions.
Unfortunately, these may be low level Unit Tests that test the implementation details.
In some cases Unit Tests are written only to pass the test coverage %
Just like a waterfall?
Assess & Plan âž” Design âž” Build âž” Test âž” Deploy âž” Manage and Maintain
Resilient - Testing Strategy:
Point of the view of technical architecture?
Testing Your Flow
Troubleshoot Flow Errors
"Throughout our development lifecycle, we continuously create and run tests. In fact, within the development phase alone we run over 1.2 million automated tests."
Ian Varley (2024): Configuring It All Out
Salesforce Developers Blog
Salesforce Developers Podcast
Georg Neumann
Flow Testing: Step-by-Step
15 mins = 100 points = woohoo!
Module: Overcome Testing Challenges with Automation
Testing Challenges:
Challenge #1: Complex DOM Structure
Challenge #2: Internal Framework Changes
Challenge #3: Objects Behind Shadow DOM
Challenge #4: 3x Releases Every Year
SFRA Testing Technologies
Supported testing technologies include these kinds of tests:
Controllers are tested with integration tests. Salesforce B2C Commerce uses mocha, chai, and request-promise for integration testing.
Models are tested with unit tests. B2C Commerce uses mocha, chai, sinon, and proxyquire for unit tests.
Views are tested with functional tests. B2C Commerce uses mocha, chai, and webdriver.io for functional tests.
Probably it's not a good idea to create test records in Production.
"Observation only" tests might be OK:
like "check that latest Currency Exchange Rates were updated in Salesforce"
There are security concerns.
tagging test records makes it easier
not to mix them with production records
to delete test records
Josh Meier (2024):
Prantap Bedi (2024):
Jae Taylor (2024):
Dmitry Melanchenko (2024):
Philippe Ozil (2022):
Dan Stead (2021):
Jonathan Au (2020):
Georg Neumann ( 2019):
(2021):
CRMCOE (2021) : (1 hour video)