Courseiva

SALESFORCE-PD1 · domain

Testing Debugging And Deployment

This domain covers writing Apex unit tests, controlling test data isolation, mocking callouts, and deploying metadata between orgs. Questions present concrete scenarios about test methods, @isTest annotations, Test.startTest/stopTest, HttpCalloutMock, and deployment tools like Change Sets, Metadata API, and Salesforce CLI, asking you to pick the correct behavior or identify a risk.

75 questions15 easy39 medium21 hard

Focused practice

Practice Testing Debugging And Deployment questions

Scored sessions drawing only from this domain — pick a length below.

Start 20-question practice test →

What this domain covers

What to know about Testing Debugging And Deployment

You must be able to write isolated Apex tests that assert results, mock callouts with HttpCalloutMock, share data via @testSetup, and deploy with adequate coverage. The single most important thing is keeping tests data-independent so they pass reliably in any org, including production deployments.

Writing Apex test methods with System.assert, Test.startTest, and Test.stopTest to verify governor limits and asynchronous behavior.

Implementing HttpCalloutMock and Test.setMock to return mock responses for callouts made during unit test execution.

Using @testSetup methods to create shared test records once per class instead of duplicating data in every test method.

Deploying components with Change Sets, Metadata API, Salesforce CLI, or Ant and understanding test coverage requirements for production.

Watch out for

Common Testing Debugging And Deployment exam traps

  • ▸Assuming a test method without assertions still counts toward code coverage; it executes but provides no verification and can hide broken logic.
  • ▸Forgetting Test.setMock before the callout, causing the test to attempt a real HTTP request and fail with a callout exception.
  • ▸Marking tests SeeAllData=true to reach existing records, which couples tests to org data, slows execution, and causes failures in fresh sandboxes.

Question index

All Testing Debugging And Deployment questions (75)

Click any question to see the full explanation, or start a practice session above.

1

What must be true for a developer to deploy Apex code to a production environment?

Medium
2

A developer wants to test an asynchronous future method. Where must the developer place the asynchronous code execution so that it runs synchronously and within the test context?

Medium
3

A developer needs to access private methods in an Apex class for unit testing without making them public. Which annotation is the most appropriate?

Medium
4

A developer needs to write a test class for an Apex class that performs DML operations. Which annotation must be used to define the class as a test class?

Easy
5

Which log level is best for finding logic flow issues without cluttering the log?

Medium
6

What is the primary function of a scratch org?

Medium
7

When is an Apex test run automatically executed?

Hard
8

When debugging a trigger, how can you view the flow of execution including entry and exit points of methods?

Medium
9

A developer is debugging a process that involves asynchronous Apex. Which Debug Log setting is required to see the output of the @future method?

Medium
10

Which TWO conditions must be met for an Apex test method to successfully execute and contribute to code coverage? (Choose two.)

Medium
11

Which THREE of the following are benefits of using the Salesforce CLI for deployment?

Easy
12

Which TWO tools or APIs can a developer use to deploy metadata between Salesforce organizations? (Choose two.)

Hard
13

Why should a developer ensure that test classes have at least 75% coverage for production deployment?

Medium
14

A developer wants to ensure that specific test data is available to all test methods in a class without recreating it. Which method should be used?

Medium
15

A developer has written a Lightning Web Component and Apex controller, and wants to deploy only these specific metadata components to a production org using Salesforce CLI without relying on change sets. Which command is appropriate?

Hard
16

When using the Metadata API to deploy components, which XML file must be present to define the components included in the package?

Hard
17

Where should a developer look in the Salesforce user interface to inspect detailed system debug logs generated during a specific transaction?

Easy
18

When calling Test.startTest() and Test.stopTest(), what happens to the governor limits?

Hard
19

Which approach is recommended to ensure test data is cleaned up?

Medium
20

You need to inspect the heap size during the execution of a long-running batch job. Which debug log category should you monitor?

Medium
21

A developer is writing a test for a method that performs a callout. How must the callout be handled?

Hard
22

When deploying metadata from a sandbox to production using Change Sets, what is the first requirement?

Easy
23

A developer is writing a unit test that executes under a specific user context to verify sharing rules. Which method should the developer use to specify the user for the subsequent test operations?

Hard
24

What happens if a developer creates a test method that does not contain any assertions?

Medium
25

A developer is writing a test method that performs a callout to an external REST service. Which interface must the developer implement to provide mock responses during the unit test execution?

Medium
26

A developer needs to see how much memory a specific Apex method is consuming. Which log category should be adjusted?

Medium
27

A developer wants to log information specifically when a condition is met. Which method is most appropriate?

Medium
28

A developer is writing an Apex test class and needs to reset governor limits before executing a block of asynchronous code testing. Which method should the developer use?

Easy
29

An asynchronous @future method is called from within an Apex test method. When are the statements inside the @future method actually executed during the test run?

Hard
30

A developer is troubleshooting a complex set of triggers and wants to restrict the amount of debug log data captured for a specific integration user. Which THREE actions can the developer take to manage debug logs effectively? (Choose three.)

Hard
31

A developer needs to verify that a trigger correctly handles bulk data, specifically 250 records. What is the most effective approach?

Medium
32

What is the primary function of the 'Developer Console'?

Easy
33

A developer is receiving 'Too many SOQL queries' errors in a trigger. What is the most likely cause?

Medium
34

Which tool is best suited for migrating metadata between two related Salesforce Orgs using a UI-based approach?

Easy
35

What is the result of a compilation error in an Apex class during deployment?

Easy
36

If a developer uses 'SeeAllData=true' in a test class, what are the primary risks?

Medium
37

How can a developer identify the most time-consuming SOQL query in a transaction?

Medium
38

What is the purpose of the 'Debug Log' Filter in the Developer Console?

Medium
39

Which TWO actions occur automatically when Test.stopTest() is called in an Apex unit test? (Choose two.)

Easy
40

You are using the Salesforce CLI to deploy code. Which command is used to deploy source code from a local project to an org?

Hard
41

Which THREE items are included in a debug log?

Medium
42

Why does a test fail if it tries to perform a callout without Test.setMock()?

Medium
43

Which THREE of the following items can be viewed in a debug log?

Medium
44

A developer is analyzing a debug log and notices that it is truncated because it exceeded the maximum file size limit. Which action should the developer take to capture only the relevant Apex code execution details without exceeding the limit?

Medium
45

What is the primary purpose of the Salesforce CLI in a CI/CD pipeline?

Medium
46

Which THREE actions are best practices when deploying Apex classes to production?

Hard
47

A developer needs to check the status of a long-running batch job that was triggered by an Apex class. Where should they look?

Medium
48

Which TWO practices are considered best practices when writing Apex unit tests in Salesforce? (Choose two.)

Easy
49

What is a 'Change Set' used for?

Easy
50

Which THREE pieces of information are displayed in the Apex Test Execution page?

Medium
51

Which THREE items are best practices when setting up test data using @TestSetup methods? (Choose three.)

Hard
52

Which log level displays the most information?

Easy
53

Which THREE things can a developer do with the Salesforce CLI?

Hard
54

Which of these is NOT a valid testing best practice?

Easy
55

When testing asynchronous Apex, how do you ensure that the scheduled job has finished before asserting results?

Hard
56

What is the primary benefit of using a Sandbox for development?

Medium
57

A developer receives a System.LimitException: Too many SOQL queries: 101 when running a complex unit test. The test class inserts a large volume of test records that inadvertently cause a trigger to execute multiple queries inside a loop. What is the most effective way to reset the governor limits specifically for the code being tested?

Hard
58

A developer needs to verify code coverage across an entire Apex organization before deploying code to production. What is the minimum overall Apex code coverage required by Salesforce for production deployment?

Easy
59

A developer is using Salesforce CLI to create a temporary environment for feature development and testing that includes all source code and shape settings. Which CLI command should the developer use to create this temporary environment?

Medium
60

A developer is using 'Test.isRunningTest()' in their production code. Why is this generally considered a poor practice?

Hard
61

An Apex trigger performs a callout to an external web service and a developer is writing a unit test for this trigger. How should the developer handle the callout during the test execution?

Hard
62

Which of the following describes the behavior of Test.stopTest()?

Medium
63

Which TWO features of @isTest(SeeAllData=true) should a developer be aware of?

Medium
64

A developer wants to inspect the code coverage of individual classes directly within the Salesforce Developer Console. Under which tab can the developer view this breakdown?

Easy
65

How can a developer inspect the state of a private variable within a class during unit testing?

Medium
66

Which TWO of the following are valid ways to trigger an Apex test run?

Medium
67

You are debugging a performance issue in an Apex trigger. You want to see the database resource usage. Which debug log level should you set for the Database category?

Medium
68

What happens if a test class has a method annotated with @testSetup that fails to insert data?

Hard
69

A developer is deploying a profile and custom fields using an Unmanaged Change Set. Upon deployment, some custom field permissions fail to apply correctly in production. What is the most likely cause of this behavior?

Medium
70

When testing a trigger, why should you avoid hard-coding IDs?

Hard
71

What is the primary purpose of the 'System.debug()' statement?

Medium
72

Which THREE of the following are true about Apex test data setup?

Medium
73

When using the Salesforce CLI to deploy, what is the 'check-only' flag used for?

Hard
74

Which THREE factors influence deployment success?

Hard
75

Which TWO of the following are valid deployment tools?

Medium

Frequently asked questions

What does the Testing Debugging And Deployment domain cover on the SALESFORCE-PD1 exam?
You must be able to write isolated Apex tests that assert results, mock callouts with HttpCalloutMock, share data via @testSetup, and deploy with adequate coverage. The single most important thing is keeping tests data-independent so they pass reliably in any org, including production deployments.
How many questions are in this domain?
This page lists all 75 Testing Debugging And Deployment questions in the SALESFORCE-PD1 question bank. The actual exam draws from this domain proportionally to its weighting in the official exam blueprint.
What is the best way to practise this domain?
Start with a short focused session (10 questions) to identify gaps, then work through explanations. Repeat with a longer session once the weak areas feel solid.
Can I practise only Testing Debugging And Deployment questions?
Yes — the session launcher on this page filters questions to this domain only. Choose any session length for inline explanations and scoring.
Salesforce Certified Platform Developer I (SALESFORCE-PD1) Testing Debugging And Deployment Practice Questions