SF-PD2 Testing, Debugging, and Deployment Practice Question
An enterprise development team uses Salesforce DX scratch orgs for feature development. A developer needs to ensure that unit tests execute automatically every time code is committed to the version control system. Which integration approach achieves this requirement?
⚠ Common exam trap
Candidates may mistakenly assume manual deployment scripts or unautomated sandbox validation satisfy continuous integration requirements for version control commits.
Answer choices
Why each option matters
Answer the question above first, then reveal the full breakdown to understand why each option is right or wrong.
Correct answer & explanation
✓
Set up a CI/CD pipeline using GitHub Actions or Jenkins to spin up a scratch org, push metadata, and run sf apex test run.
Integrating CI/CD pipelines with version control hooks automates validation processes. Utilizing Salesforce CLI commands within CI runners guarantees that code meets quality gates and test coverage thresholds before merging into shared branches, protecting code health and reducing integration debt across large distributed development teams.
Answer analysis
Option-by-option breakdown
For each option: why learners choose it and why it is or isn't the right answer here.
- ✗
Configure a scheduled Apex job in the scratch org to run all tests nightly and email logs to the engineering team.
Why it's wrong here
A nightly scheduled job runs on a timer, not on commit events, so it cannot satisfy the every-commit requirement. Scheduled test runs suit regression sweeps or overnight quality gates where event-driven execution is not needed.
- ✓
Set up a CI/CD pipeline using GitHub Actions or Jenkins to spin up a scratch org, push metadata, and run sf apex test run.
Why this is correct
CI/CD tools execute headless shell scripts triggered by git push events. Running Salesforce CLI commands inside pipeline agents allows teams to create temporary scratch orgs, deploy code changes, execute tests, and enforce quality gates automatically.
- ✗
Rely on developers to manually execute unit tests in their local IDE terminals before pushing commits to remote branches.
Why it's wrong here
Manual execution depends on developer discipline and cannot guarantee tests run on every commit, so the automation requirement is unmet. Local IDE testing is appropriate for rapid developer feedback during coding, but continuous integration requires a pipeline that triggers on commit events.
- ✗
Configure a change set deployment validation rule that triggers whenever a pull request is opened in GitHub.
Why it's wrong here
Change sets are Salesforce metadata deployment containers and cannot be triggered by GitHub pull requests; no such validation rule exists. Change sets suit manual metadata promotion between related orgs, not CI test execution on commit.
About these practice questions
Courseiva writes every SF-PD2 question from scratch — 226 in total, each with an explanation and a wrong-answer breakdown. None are copied from real exams or dumps. Learn why practice questions differ from exam dumps →
JA
Written and reviewed by Johnson Ajibi, MSc IT Security
Senior Network & Security Engineer · founder of Courseiva
Last reviewed September 2026 · checked against the official Salesforce exam blueprint
This SF-PD2 practice question is part of Courseiva's free Salesforce certification practice question bank. Courseiva provides original exam-style practice questions with explanations, topic-based practice, mock exams, readiness tracking, and study analytics to help learners prepare for the SF-PD2 exam.