Salesforce DX (Developer Experience) brings modern dev practices to Salesforce. Affects testing:
Scratch orgs for testing:
- Spin up disposable orgs.
- Each test run in fresh environment.
- Reproducible.
- Isolated.
Source-driven:
- Code in Git; tests in Git.
- Branch per feature.
- Test in feature branch before merge.
CI/CD:
- Tests run automatically on PR.
- Quality gates.
- Fast feedback.
Tooling:
- VS Code Salesforce Extensions — run tests inline.
- Salesforce CLI — scripted test execution.
- Apex Replay Debugger — debug from logs.
- Jest — LWC testing locally.
Differences from old way:
Old: tests run in shared sandbox; manual triggers; flaky.
New: tests run in scratch orgs; automated; reproducible.
Test-driven development possible:
- Write test first.
- Run locally; sees failure.
- Implement code; run again; sees pass.
Continuous integration normal:
- Every commit triggers tests.
- Coverage tracked over time.
- Trends visible.
Architecture:
- Sources of truth: Git (metadata + code), Salesforce (runtime).
- Tests version-controlled.
- Test data in factories, not org-specific.
Common pitfalls:
- DX adoption without test discipline — opportunity wasted.
- Tests that depend on org data — break in scratch orgs.
- No quality gates — broken code reaches main.
Senior insight: DX enables modern QA practices. Without DX, you're constrained.
