PDI practice question 28 of 30

What are two considerations for deploying from a sandbox to production? Choose 2 answers

Full set: 201 questions
Answer options
A: At least 75% of Apex code must be covered by unit tests. Correct answer
B: Unit tests must have calls to the System.assert method.
C: Should deploy during business hours to ensure feedback can be quickly addressed.
D: All triggers must have at least one line of test coverage. Correct answer
Correct Answer:
A. At least 75% of Apex code must be covered by unit tests.; D. All triggers must have at least one line of test coverage.
Explanation

Salesforce enforces strict code coverage requirements for deploying Apex code to a production environment to ensure stability and quality. The platform mandates that a minimum of 75% of the total number of lines of Apex code in the organization (excluding test classes) must be covered by unit tests. Additionally, every Apex trigger in the deployment must have at least some test coverage (greater than 0%). Failure to meet either of these conditions will cause the deployment to fail. These are non-negotiable platform prerequisites for any production deployment containing Apex.

Why Incorrect

B. While using System.assert methods is a critical best practice to verify code logic, it is not a mandatory platform requirement for deployment. Tests can pass without assertions.
C. This is a business process consideration, not a technical requirement. Best practice is typically to deploy during off-peak hours to minimize disruption to business operations.

References

1. Salesforce Apex Developer Guide, "Running Unit Test Methods":

"To deploy Apex to a production organization...at least 75% of Apex code must be covered by tests, and all of those tests must pass."

"Every trigger must have some test coverage."

2. Salesforce Apex Developer Guide, "Testing Best Practices":

"Verify the results are correct. Use the System.assertEquals() methods to prove that your code is behaving properly. Although assertions are not required for a test to run or to be deployed, they are critical for verifying the behavior of your code." This confirms that assertions are a best practice, not a deployment requirement.

Scroll to Top