PDI · Question #190
What are two considerations for deploying from a sandbox to production? Choose 2 answers
The correct answer is B. All triggers must have at least one line of test coverage. C. At least 75% of Aptx code must be covered by unit tests.. When deploying Apex code from a sandbox to production, all triggers must have at least one line of test coverage, and the overall Apex code coverage must be at least 75%.
Question
What are two considerations for deploying from a sandbox to production? Choose 2 answers
Options
- AShould deploy during business hours to ensure feedback can be Quickly addressed
- BAll triggers must have at least one line of test coverage.
- CAt least 75% of Aptx code must be covered by unit tests.
- DUnit tests must have calls to the System.assert method.
How the community answered
(29 responses)- A3% (1)
- B93% (27)
- D3% (1)
Why each option
When deploying Apex code from a sandbox to production, all triggers must have at least one line of test coverage, and the overall Apex code coverage must be at least 75%.
Deploying during business hours is generally discouraged for critical changes, as it can disrupt users; deployments are often scheduled during off-peak hours or maintenance windows to minimize impact.
Salesforce deployment requirements mandate that every Apex trigger in a deployment must have at least one line of test coverage, ensuring basic functionality is tested before deployment to production.
To successfully deploy Apex code to a production environment, the overall code coverage for all Apex classes and triggers in the organization (or within the deployment package, depending on specific settings) must meet a minimum threshold of 75% by unit tests.
While it is a best practice to include `System.assert` methods in unit tests to validate expected outcomes, it is not a mandatory deployment requirement for test classes to pass; tests pass as long as they run without uncaught exceptions and cover the required percentage of code.
Concept tested: Apex deployment validation requirements
Source: https://developer.salesforce.com/docs/atlas.en-us.deployment.meta/deployment/deploy_test_levels.htm
Topics
Community Discussion
No community discussion yet for this question.