Unit 1: Get A Refresh On Testing: Learning Objectives
Unit 1: Get A Refresh On Testing: Learning Objectives
Unit 1: Get A Refresh On Testing: Learning Objectives
Key Topics
This unit prepares you for the Testing, Debugging, and Deployment section of the Platform Developer I exam,
which makes up 17% of the overall exam. This section of the exam tests these topics.
This unit provides a number of interactive, real-world, scenario-based questions that are a lot like the ones you
can encounter as a Salesforce developer. Looking at these scenarios helps prepare you to take the testing
section of the Platform Developer I exam. As you tackle the practice questions, you get immediate feedback on
your answers, along with detailed information on why your answers are correct (or incorrect).
The unit also contains interactive flashcards to help you prepare for this section of the exam.
1
Platform Developer I Certification Prep: Testing, Debugging and Deployment
Scenario 1
A developer creates a new Visualforce page and Apex extension, and writes test classes that exercise 95%
coverage of the new Apex extension. Change set deployment to production fails with the test coverage
warning: "Average test coverage across all Apex classes and triggers is 74%, at least 75% test coverage is
required." What can the developer do to successfully deploy the new Visualforce page and extension?
ANSWER FEEDBACK
A. CREATE TEST CLASSES TO EXERCISE Incorrect. Test classes can cover only Apex classes, not
THE VISUALFORCE PAGE MARKUP. Visualforce pages.
B. SELECT FAST DEPLOYMENT TO Incorrect. The correct wording is “quick deployment”, but
BYPASS RUNNING ALL THE TESTS. the developer still wants to make sure all tests pass, so
running a quick deployment is not enough.
C. SELECT 'DISABLE PARALLEL APEX Incorrect. Disabling parallel Apex testing does not change
TESTING' TO RUN ALL THE TESTS. the 75% code coverage requirement.
D. ADD TEST METHODS TO EXISTING Correct. This increases the code coverage on the rest
TEST CLASSES FROM PREVIOUS of the Apex classes in the org.
DEPLOYMENTS.
2
Platform Developer I Certification Prep: Testing, Debugging and Deployment
Scenario 2
ANSWER FEEDBACK
A. INCREASED TEST COVERAGE REQUIRES Incorrect. The number of lines of code in the test
LARGE TEST CLASSES WITH MANY LINES OF class does not matter, what matters is the amount
CODE IN ONE METHOD. of lines that the unit test covers.
B. TRIGGERS DO NOT REQUIRE ANY UNIT Incorrect. Triggers need to be covered by unit tests
TESTS IN ORDER FOR YOU TO DEPLOY THEM as well in order to be deployed.
FROM SANDBOX TO PRODUCTION.
C. UNIT TESTS WITH MULTIPLE METHODS Incorrect. When one method fails, the other test
RESULT IN ALL METHODS FAILING WHEN ONE methods can still succeed.
METHOD FAILS.
D. SYSTEM ASSERT STATEMENTS THAT DO Correct. Tests should assert your application’s
NOT INCREASE CODE COVERAGE CONTRIBUTE behavior to ensure quality of code and verify
IMPORTANT FEEDBACK IN UNIT TESTS. expected results.
3
Platform Developer I Certification Prep: Testing, Debugging and Deployment
Scenario 3
ANSWER FEEDBACK
A. CREATE DATA FOR TESTING. CALL THE Correct. Creating your own data makes the
METHOD BEING TESTED. VERIFY THAT THE method independent of the data in your org.
RESULTS ARE CORRECT. Doing this helps to avoid errors when moving
your code from one org to another. To verify
that the method works as expected call it
using different inputs based on the data that
was created.
B. QUERY FOR TEST DATA USING Incorrect. SeeAllData=true should only be used in
SEEALLDATA=TRUE. CALL THE METHOD BEING specific scenarios when the data cannot be
TESTED. VERIFY THAT THE RESULTS ARE created on the test class.
CORRECT.
C. CREATE DATA FOR TESTING. EXECUTE Incorrect. unAllTests() executes all the methods in
RUNALLTESTS(). VERIFY THAT THE RESULTS the test class.
ARE CORRECT.
D. QUERY FOR TEST DATA USING Incorrect. SeeAllData=true should only be used in
SEEALLDATA=TRUE. EXECUTE RUNALLTESTS(). specific scenarios when the data cannot be
VERIFY THAT THE RESULTS ARE CORRECT. created on the test class.
4
Platform Developer I Certification Prep: Testing, Debugging and Deployment
Scenario 4
A developer has a single custom controller class that works with a Visualforce wizard to support creating and
editing multiple sObjects. The wizard accepts data from user inputs across multiple Visualforce pages and from
a parameter on the initial URL. Which three statements are necessary inside the unit test for the custom
controller?
ANSWER FEEDBACK
5
Platform Developer I Certification Prep: Testing, Debugging and Deployment
Scenario 5
An org has different Apex classes that provide account-related functionality. After a new validation rule is
added to the Account object, many of the test methods fail. Which two actions will resolve the failures and
reduce the number of code changes needed for future validation rules? (Select two answers.)
ANSWER FEEDBACK
A. CREATE A METHOD THAT CREATES VALID Correct. In test classes, the developer needs
ACCOUNT RECORDS, AND CALL THIS METHOD to first create the test records.
FROM WITHIN TEST METHODS.
B. CREATE A METHOD THAT QUERIES FOR VALID Incorrect. The developer needs to create the test
ACCOUNT RECORDS, AND CALL THIS METHOD records before querying them.
FROM WITHIN TEST METHODS.
C. CREATE A METHOD THAT LOADS VALID Correct. In test classes, the developer needs
ACCOUNT RECORDS FROM A STATIC to first populate the test records.
RESOURCE, AND CALL THIS METHOD WITHIN
TEST METHODS.
D. CREATE A METHOD THAT PERFORMS A Incorrect. The developer needs to create the test
CALLOUT FOR A VALID ACCOUNT RECORD, AND records before validating them.
CALL THIS METHOD FROM WITHIN TEST
METHODS.
6
Platform Developer I Certification Prep: Testing, Debugging and Deployment
Scenario 6
When working in a sandbox environment, which two things should the developer use to verify the functionality
of a new test class before the developer deploys that test class to production? (Select two answers.)
ANSWER FEEDBACK
A. TEST MENU IN THE DEVELOPER CONSOLE Correct. In the Developer Console, you can
execute some or all tests in specific test
classes, set up and run test suites, or run all
tests.
B. RUN TESTS MENU PAGE IN SALESFORCE Incorrect. There is not a page called Run Tests in
SETUP Salesforce Setup.
C. REST API AND APEXTESTRUN METHOD Incorrect. There is not a method called
ApexTestRun.
D. APEX TEST EXECUTION PAGE IN SALESFORCE Correct. You can run unit tests on the Apex
SETUP Test Execution page. The Apex Test Execution
page refreshes the status of a test and
displays the results after the test completes.
7
Platform Developer I Certification Prep: Testing, Debugging and Deployment
Scenario 7
A developer has a block of code that omits any statements that indicate whether the code block should
execute with or without sharing.
What will automatically obey the organization-wide defaults and sharing settings for the user who executes the
code in the Salesforce organization?
ANSWER FEEDBACK
8
Platform Developer I Certification Prep: Testing, Debugging and Deployment
Read the question or term on each card, then click the card to reveal the correct answer. Click the right-facing
arrow to move to the next card, and the left-facing arrow to return to the previous card.
Question/Term Answer/Definition
A developer creates an Apex
class that has private
methods. What can the Add the @TestVisible attribute to the
developer do to ensure that methods.
the test class can access the
private methods?
9
Platform Developer I Certification Prep: Testing, Debugging and Deployment
Related Badges
Module
Apex Testing
Module
Module
User Authentication
Congratulations! You’ve studied up on all things related to testing. Up next, let’s dive in to the exam section on
debugging and deployment. Let's go!
10
Platform Developer I Certification Prep: Testing, Debugging and Deployment
Key Topics
This unit prepares you for the debugging and deployment topics in the Testing, Debugging, and Deployment
section of the Platform Developer I exam. This section of the exam tests these topics.
• Deployment
• Debugging
• Salesforce DX
• Salesforce CLI
• Developer Console
11
Platform Developer I Certification Prep: Testing, Debugging and Deployment
Scenario 1
A developer created an Apex trigger using the Developer Console and now wants to debug code. How can the
developer accomplish this in the Developer Console?
ANSWER FEEDBACK
A. SELECT THE OVERRIDE LOG Incorrect. There is no Override Log Triggers checkbox.
TRIGGERS CHECKBOX FOR THE
TRIGGER.
B. OPEN THE PROGRESS TAB IN THE Incorrect. There is no Progress tab in the Developer
DEVELOPER CONSOLE. Console.
C. OPEN THE LOGS TAB IN THE Correct. Use the Logs tab in the Developer Console to
DEVELOPER CONSOLE. open debug logs.
D. ADD THE USER NAME IN THE LOG Incorrect. The Log Inspector tracks the logs; there is no
INSPECTOR. way to add a user name to it.
12
Platform Developer I Certification Prep: Testing, Debugging and Deployment
Scenario 2
Which two types of information does the Checkpoints tab in the Developer Console provide? (Select two
answers.)
ANSWER FEEDBACK
B. EXCEPTION
Incorrect. The Checkpoints tab does not display exception
information.
D. DEBUG STATEMENT Incorrect. The Checkpoints tab does not display debug
statement information.
13
Platform Developer I Certification Prep: Testing, Debugging and Deployment
Scenario 3
What are two valid source and destination pairs that can send or receive change sets? (Select two answers.)
ANSWER FEEDBACK
C. DEVELOPER EDITION ORG TO Incorrect. Change sets can only be sent between orgs that
PRODUCTION are affiliated with a production org.
14
Platform Developer I Certification Prep: Testing, Debugging and Deployment
Scenario 4
Which two components can you deploy using Metadata API? (Select two answers.)
ANSWER FEEDBACK
15
Platform Developer I Certification Prep: Testing, Debugging and Deployment
Scenario 5
Which two answers are true for a partial sandbox but do not apply to a full sandbox? (Select two answers.)
ANSWER FEEDBACK
D. ONLY INCLUDES NECESSARY Incorrect. Partial sandboxes include the metadata as well
METADATA as sample data.
16
Platform Developer I Certification Prep: Testing, Debugging and Deployment
Read the question or term on each card, then click on the card to reveal the correct answer. Click the right-
facing arrow to move to the next card, and the left-facing arrow to return to the previous card.
Question/Term Answer/Definition
In which Salesforce environment
should a developer build a Developer Edition
managed package?
17
Platform Developer I Certification Prep: Testing, Debugging and Deployment
Related Badges
Module
Asynchronous Apex
Module
Great work! You’ve reviewed the testing, debugging, and deployment sections of the Platform Developer I
exam.
18