Many Salesforce teams still release the way they did years ago: build in a sandbox, collect components into a change set, test manually, deploy on a Friday evening and hope. It works until the org grows, several people change the same objects and a small Flow update quietly breaks an integration.
Salesforce DevOps replaces hope with a repeatable process. This guide covers the building blocks: environments, source control, CI/CD, test automation, quality gates and metrics, plus a sample pipeline and a 90-day plan to adopt it.
| Environment | Data | Refresh interval | Typical use |
|---|---|---|---|
| Scratch org | None by default; seeded by scripts | Created on demand, short-lived | Feature development and automated tests from source |
| Developer sandbox | Metadata only, 200 MB data | Daily | Individual development and experiments |
| Developer Pro sandbox | Metadata only, 1 GB data | Daily | Development, integration and QA with test data |
| Partial Copy sandbox | Metadata plus a sample of production data, 5 GB | Every 5 days | QA, integration testing, training |
| Full sandbox | Full copy of production | Every 29 days | User acceptance, performance and staging |
Use a class implementing the SandboxPostCopy interface to run set-up automatically after a refresh, such as masking email addresses or disabling outbound integrations.
| Option | Strengths | Consider when |
|---|---|---|
| Salesforce CLI with a CI service (GitHub Actions, GitLab CI, Azure DevOps, Bitbucket Pipelines, Jenkins) | Flexible, low licence cost, full control | You have developers comfortable with scripting and pipelines |
| DevOps Center | Salesforce-native, approachable for admins, connects to source control | You are moving from change sets and want a guided process |
| Third-party Salesforce DevOps platforms | Metadata comparison, rollback, backup, data seeding, compliance reporting and integrated testing | You have a large team, complex org or strict audit requirements |
Access metadata causes more failed and surprising deployments than almost anything else. What a retrieved profile contains depends on which other components are retrieved with it, so deploying a profile can unintentionally overwrite permissions. A sustainable approach:
| Layer | What it covers | Tools |
|---|---|---|
| Static analysis | Security and performance issues, coding standards | Salesforce Code Analyzer, ESLint for components |
| Apex unit tests | Business logic, triggers, bulk behaviour, security enforcement | Apex test framework |
| Component tests | Lightning Web Component behaviour and rendering | Jest with the Salesforce LWC Jest package |
| Flow tests | Record-triggered Flow paths and outcomes | Flow tests in Flow Builder, plus Apex tests for Flow-driven outcomes |
| API and integration tests | Callouts, inbound APIs, Platform Events, error handling | Apex mocks, API testing tools, integration environments |
| UI end-to-end tests | Critical user journeys across pages | UTAM with browser automation, or commercial Salesforce testing tools |
| User acceptance testing | Business fit and usability | Structured scripts in a Full or Partial Copy sandbox |
Salesforce requires at least 75% Apex code coverage to deploy to production, but coverage alone proves little. Good tests create their own data, test positive, negative and bulk scenarios, and assert outcomes. If you are hiring for this skill, our list of Salesforce developer interview questions includes what good test practice looks like.
A minimal pull request validation job with GitHub Actions and the Salesforce CLI might look like this:
name: validate-salesforce
on:
pull_request:
branches: [main]
jobs:
validate:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: 20
- run: npm install --global @salesforce/cli
- run: npm ci && npm run test:unit
- name: Authenticate to the CI org
run: |
echo "${{ secrets.SF_CI_AUTH_URL }}" > auth.txt
sf org login sfdx-url --sfdx-url-file auth.txt --alias ci
- name: Check-only deployment with Apex tests
run: sf project deploy validate --source-dir force-app --target-org ci --test-level RunLocalTests --wait 60
Store the authentication URL as an encrypted secret, use a dedicated integration user with only the permissions deployment needs, and never commit credentials to the repository.
Production issues will still happen, so define the hotfix path before you need it: branch from the version currently in production, fix and test in a dedicated sandbox, run the same validation and tests as a normal release, deploy, and then merge the fix back into the main branch immediately so the next release does not reintroduce the bug. Skipping the pipeline "just this once" is exactly how orgs drift out of sync with source control.
The widely used DORA metrics translate well to Salesforce:
Groviya’s quality engineering and Salesforce teams set up DevOps pipelines, write meaningful Apex and component tests, and build automated regression suites for Salesforce and custom applications. See our quality assurance and testing services or talk to a DevOps specialist.