PDI · Question #168
PDI Question #168: Real Exam Question with Answer & Explanation
The correct answer is A: Apex classes must have at least 75% code coverage org-wide.. For deployment to production, individual Apex classes must achieve at least 75% code coverage, and Apex triggers must have at least one line of code covered by unit tests.
Question
A develop completed modification to a customized feature that is comprised of two elements: Apex trigger Trigger handler Apex class What are two factors that the developer must take into account to properly deploy the modification to the production environment?
Options
- AApex classes must have at least 75% code coverage org-wide.
- BAt least one line of code must be executed for the Apex trigger.
- CAll methods in the test classes must use @isTest.
- DTest methods must be declared with the testMethod keyword.
Explanation
For deployment to production, individual Apex classes must achieve at least 75% code coverage, and Apex triggers must have at least one line of code covered by unit tests.
Common mistakes.
- C. Not all methods within a test class must use the
@isTestannotation; only the class itself needs it, or individual methods can be markedtestMethodif the class is not annotated. - D. Test methods can be declared with the
testMethodkeyword, but they can also simply be public static methods within a class annotated with@isTest.
Concept tested. Apex Code Deployment Requirements
Reference. https://developer.salesforce.com/docs/atlas.en-us.apexcode.meta/apexcode/apex_code_test_methods.htm
Topics
Community Discussion
No community discussion yet for this question.