PD1 Testing, Debugging & Deployment 3 — Questions and Answers
Question 1: Which log level provides the most detailed output when debugging Apex code in the Developer Console?
- WARN
- INFO
- FINE
- FINEST (Correct answer)
Correct answer: FINEST
FINEST is the most verbose log level and captures the greatest detail about code execution, including variable values.
Question 2: What is the purpose of the Test.startTest() and Test.stopTest() methods in Apex testing?
- They mark the start and end of the test class
- They reset governor limits and allow asynchronous jobs to complete (Correct answer)
- They enable mock callouts within their boundary
- They prevent DML from being rolled back
Correct answer: They reset governor limits and allow asynchronous jobs to complete
Test.startTest() resets governor limits and Test.stopTest() forces any asynchronous operations queued during the test to execute synchronously.
Question 3: Which Salesforce feature allows you to deploy a validated change set immediately without re-running all tests?
- Quick Deploy (Correct answer)
- Fast Deploy
- Express Deploy
- Instant Deploy
Correct answer: Quick Deploy
Quick Deploy lets you promote a successfully validated change set within 4 days without re-running tests, saving deployment time.
Question 4: Which interface must a class implement to be used as an HTTP callout mock in Apex tests?
- HttpCalloutMock (Correct answer)
- WebServiceMock
- CalloutMock
- MockHttp
Correct answer: HttpCalloutMock
HttpCalloutMock requires implementing the respond(HttpRequest) method that returns a fake HttpResponse during tests.
Question 5: When deploying metadata using the Salesforce CLI (sf or sfdx), which command deploys source-tracked changes to a scratch org?
- sf project deploy start
- sf deploy org push
- sf source push (Correct answer)
- sf org deploy changes
Correct answer: sf source push
sf source push (or sfdx force:source:push) tracks local changes and pushes only modified metadata to a scratch org.
Question 6: What does the SeeAllData=true annotation in @isTest do?
- Allows the test to access all records in the org (Correct answer)
- Forces the test to create its own data
- Enables access to setup objects only
- Grants read-only access to custom objects
Correct answer: Allows the test to access all records in the org
@isTest(SeeAllData=true) bypasses test data isolation so the test can query existing records in the org, which is generally discouraged.
Question 7: Which debug log category specifically captures information about SOQL queries and DML operations during Apex execution?
- Apex Code
- Database (Correct answer)
- Workflow
- Callout
Correct answer: Database
The Database log category logs SOQL queries, DML operations, and database-level events like row counts.
Which log level provides the most detailed output when debugging Apex code in the Developer Console?