- Home
- /
- Salesforce Testing
- /
- DevOps Testing
- /
- CI/CD Testing
Salesforce CI/CD Testing
Salesforce CI/CD testing is the design of which tests run at each stage of a continuous integration and delivery pipeline, from the first commit to production. It decides where static analysis, Apex unit tests, LWC Jest, check-only deploys and functional regression belong, so feedback stays fast early and coverage gets deeper as a change moves closer to users.
This page is tool-agnostic; the same stage design applies whether the runner is Azure DevOps, GitHub Actions, Jenkins, GitLab or a DevOps platform.
The problem CI/CD testing solves on Salesforce
Continuous integration was built for codebases where a compiler and a unit test suite tell you most of what you need to know. Salesforce is different. A large share of change is declarative: record-triggered Flows, validation rules, page layouts, Lightning record pages, permission sets and sharing rules. None of that is exercised by an Apex unit test unless someone wrote one specifically, and much of it depends on data and user context that a unit test does not reproduce.
So a Salesforce pipeline that only runs sf project deploy start with RunLocalTests gives a partial answer. The code compiled, the local tests passed, coverage cleared 75%. Meanwhile a new required field has broken the Screen Flow sales reps use to log calls, and nobody finds out until they do. CI/CD testing is the discipline of placing the missing checks at the right stage, with an explicit budget for how long each stage may take.
This page covers stage design across the whole pipeline. Runner-specific wiring is covered on Azure DevOps and GitHub Actions, the pass/fail rules on quality gates, and the practice of keeping tests running continuously on continuous testing.
A stage-by-stage test map
Each stage has a time budget and a question it must answer. Tests that cannot fit the budget move later; tests that could catch the issue earlier move forward.
| Pipeline stage | Tests that belong here | Typical time budget |
|---|---|---|
| Local and pre-commit | Salesforce Code Analyzer or PMD, Prettier and ESLint, LWC Jest for changed components | Seconds to a couple of minutes |
| Pull request | Static analysis, delta Apex tests in a scratch org or developer sandbox, small functional pack on changed objects | Under 15 to 20 minutes |
| Merge to integration branch | Check-only deploy with RunLocalTests to the integration sandbox, impact-mapped functional regression | 30 to 60 minutes |
| Release candidate to UAT | Full deploy to a partial or full copy sandbox, broad regression across affected processes and personas, security regression | A few hours, often scheduled |
| Pre-production validation | Validate against production with the final test level, confirm destructive changes, retain job ID for quick deploy | Depends on org test volume |
| Production | Quick deploy, then a smoke pack on critical journeys and integrations | Minutes after deployment |
| Scheduled | Nightly full regression and org drift checks that selection-based runs may skip | Overnight |
Environment choices and what they mean for tests
Where a test runs determines what it can prove. Salesforce offers several environment types, each with trade-offs.
Scratch orgs
Created from a definition file in minutes and disposable, ideal for isolated PR checks. They start empty, so functional tests need scripted data and cannot reflect production configuration drift.
Developer sandboxes
Copy production metadata but no data. Useful as long-lived per-developer or per-team CI targets when scratch org features do not match the production shape.
Partial copy sandboxes
Include a sample of production data defined by a sandbox template. A good home for integration-branch functional regression with realistic relationships.
Full copy sandboxes
Mirror production data and are refreshed rarely. Best for final performance, large data volume and release-candidate regression, but a scarce shared resource.
Production validate
A check-only deploy against production proves the package deploys and tests pass in the real org without committing a change.
Production after release
Only non-destructive smoke checks belong here, with dedicated test records or read-only verification to avoid polluting business data.
Selecting tests instead of running everything
The fastest way to kill a CI/CD program is a pipeline that takes four hours on every merge. Developers batch changes to avoid it, which defeats continuous integration. The fix is selection: use the component delta to decide which Apex tests and which functional regression packs are relevant.
For Apex, a delta can drive RunSpecifiedTests at the pull request stage, as long as the team understands that each class and trigger in the deployment needs 75% coverage from the specified tests when that level is used against production. For functional tests, a mapping from metadata to business processes does the same job: a change to the Opportunity validation rules pulls in the opportunity management and quote packs, a change to a Case assignment Flow pulls in case routing. Dependency analysis supplies the references that make this mapping reliable, and AI test selection is one way to rank the candidates.
Selection must be conservative and it must have a safety net. When in doubt, include the pack. And run the full suite on a schedule, because selection only catches what the mapping knows about. SyntraFlow is designed to recommend packs from a change set and to be called from any CI stage to run them, which is available for demonstration and proof-of-concept validation.
Adding functional testing to an existing pipeline
Most teams already deploy through a pipeline. These steps add a functional layer without rebuilding it.
Inventory the current stages
Write down every stage, its trigger, its target org and its test level. Note which stages already block promotion and which only report.
Pick the critical journeys
Choose five to fifteen business processes whose failure would be a production incident, such as lead conversion, quote approval or case escalation, and automate those first.
Stabilize data for the target org
Make sure each CI org has the records tests need, using synthetic test data or seeding scripts, so results reflect the change rather than missing data.
Add a stage that calls the suite
Insert a job after the deploy to the integration sandbox that triggers the functional run, waits for it, and fails on critical failures. Start in report-only mode for a few weeks.
Tune and then enforce
Fix flaky tests and false positives, agree which failures block, then switch the stage to blocking and connect it to the gate that controls promotion.
Extend forward and backward
Add a lighter pack to pull requests and a smoke pack after production deploys once the integration stage is trusted.
Common Salesforce CI/CD testing mistakes
Patterns that make pipelines slow, noisy or falsely reassuring.
- Treating code coverage as quality. An org can sit at 85% coverage with tests that assert nothing, while untested Flows carry most of the business logic.
- Running functional tests in a scratch org with no data and concluding the change is safe, then deploying to an org where record types, sharing and existing automation behave differently.
- Letting a shared integration sandbox accumulate half-merged changes from abandoned branches, so failures cannot be attributed to the change under test.
- Ignoring destructive changes in CI. A deleted field that a report, Flow or integration still references often surfaces only in a later environment.
- Leaving flaky UI tests in blocking stages. Teams learn to rerun until green, and the gate stops meaning anything.
- Skipping profile and permission set checks because they are hard to automate, even though access changes are among the most common causes of post-release tickets; see permission set testing.
- Stopping validation at the Salesforce boundary when the change feeds an ERP, billing or identity system downstream.
Signals a healthy pipeline produces
Qualitative indicators that CI/CD testing is working rather than just running.
Failures point to a cause
A red stage names the process, the persona and the component involved, so a developer can act without rerunning locally.
Reruns are rare
Tests fail because something broke, not because of timing or data collisions, so nobody reruns to get green.
Stages stay inside budget
Pull request feedback arrives while the author still has context, and deep regression runs where time is available.
Evidence is automatic
Every promotion carries a record of what was tested and what passed, without a person assembling screenshots.
Related pages
DevOps testing hub
How CI/CD testing fits into the wider pipeline validation layer.
Pull-request testing
The earliest blocking stage in the pipeline, covered in depth.
Quality gates
Turning each stage's results into enforceable pass/fail decisions.
Deployment validation testing
The pre-production validate and quick deploy stage explained.
Deployment impact analysis
Understanding what a change set touches before choosing tests.
Regression automation
Building the maintained suite that CI stages draw from.
CI/CD Testing testing FAQs
What is Salesforce CI/CD testing?
It is the practice of deciding which automated tests run at each stage of a Salesforce continuous integration and delivery pipeline, and making those tests control whether a change advances. It spans static analysis, Apex and LWC unit tests, check-only deployments, functional regression in sandboxes and smoke checks after production deploys.
Are Apex tests enough for a Salesforce pipeline?
No. Apex tests verify Apex logic and are required for production deploys, but much Salesforce behavior lives in Flows, validation rules, layouts, permission sets and sharing. Those need functional tests that act as real users in an org with realistic data.
Should CI use scratch orgs or sandboxes?
Usually both. Scratch orgs suit fast, isolated pull request checks for source-driven projects. Sandboxes, especially partial and full copies, are better for functional regression because they reflect production configuration and data shape. Many teams use scratch orgs early and sandboxes from the integration stage onward.
How long should a Salesforce CI pipeline take?
There is no single number, but pull request stages that exceed roughly twenty minutes tend to change developer behavior for the worse. Keep early stages delta-based and move broad regression to integration, release and scheduled runs where longer durations are acceptable.
How does CI/CD testing differ from continuous testing?
CI/CD testing is about stage design: which tests run where in the pipeline. Continuous testing is the broader practice of keeping feedback flowing on every change and over time, including scheduled runs, flaky test management and suite maintenance.
Can SyntraFlow run as a stage in our existing pipeline?
SyntraFlow is designed to be triggered from a pipeline stage on any CI runner, run the selected regression packs against a target org, and return a result and evidence record the stage can act on. This is available for demonstration and proof-of-concept validation; it does not replace the tool that deploys your metadata.
Put the right tests at every pipeline stage
Walk through your current Salesforce pipeline with us and see where a functional validation stage would fit.