PDI practice question 15 of 30
A developer completed modifications 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 them to the production environment? Choose 2 answers
Full set: 201 questionsWhen deploying Apex code to a production environment, Salesforce enforces specific code coverage requirements to ensure code quality and reliability. The developer must ensure that the Apex classes and triggers being deployed achieve a cumulative code coverage of at least 75%. Additionally, a specific rule applies to triggers: every trigger included in the deployment must have at least one line of code executed by a test method, meaning its coverage must be greater than 0%. Both of these conditions must be met for the deployment to succeed.
B. All methods in the test classes must use @istest. This is incorrect. Test classes can include helper methods (e.g., for creating test data) that are not actual tests and therefore are not annotated with @isTest.
D. Test methods must be declared with the testMethod keyword. This is incorrect. The testMethod keyword is a legacy syntax. The current, standard practice is to use the @isTest annotation to define test methods.
1. 75% and Trigger Coverage Rule: The Apex Developer Guide explicitly states the deployment requirements.
"Before you can deploy your code or package it for the AppExchange, at least 75% of Apex code must be covered by tests, and all those tests must pass... Also, every trigger must have some test coverage."
Source: Salesforce Apex Developer Guide, "Run Unit Test Methods", Section: Code Coverage Requirements.
2. @isTest Annotation vs. testMethod Keyword: The documentation clarifies the modern standard for defining test methods.
"Methods of a test class that are test methods must be annotated with @isTest... Alternatively, test methods can be defined with the testMethod keyword, but this is an older syntax."
Source: Salesforce Apex Developer Guide, "Apex Annotations", Section: @isTest Annotation.
3. Helper Methods in Test Classes: The documentation provides examples showing that not all methods in a test class are test methods.
"A test class is a class that is annotated with @isTest... Test classes can also have methods that are not test methods. These methods are typically helper methods that are called by test methods."
Source: Salesforce Apex Developer Guide, "Execution Governors and Limits", Section: Per-Transaction Apex Limits (context on test methods and their structure).
Keep practicing
Take the free PDI practice test
Ten exam-style questions with answers and explanations, plus the exam facts and study guides.
More questions
Other PDI practice questions
- Question 1What can be used to override the Account's standard Edit button for Lightning Experience?
- Question 4Universal Containers (UC) wants to lower its shipping cost while making the shipping proc…
- Question 5A developer has an integer variable called maxAttempts. The developer needs to ensure tha…
- Question 7Universal Containers wants to back up all of the data and attachments in its Salesforce o…
- Question 8Universal Containers hires a developer to build a custom search page to help users find t…
- Question 9As part of new feature development, a developer is asked to build a responsive applicatio…
