Testing, Debugging, and Deployment (17%) Flashcards
Can anonymous code be executed to test Apex classes?
NO!
Major differences in executing Apex code anonymously and in unit tests:
- Anonymous code commits data changes to the system.
- Anonymous code does not provide code coverage.
- Anonymous code is executed in user mode with sharing enforced.
- Anonymous code is not saved or stored, even when executed (but it will generate a debug log!)
- Anonymous code does not reset governor limits if startTest() and stopTest() methods are used.
Proper procedure for unit testing
- Create test data
- Call the Apex class method in the test method
- Verify results
What are the different tools you can use to run Apex test methods?
- Developer console
- Salesforce UI (Apex Test Execution in Setup)
- VS Code
- SOAP API
What groupings of unit tests can you run?
- Some or all methods in a specific class
- Some or all methods in a set of classes
- Test suite (predefined suite of classes)
- All unit tests in your org
What is NOT counted as part of Apex code coverage?
- Calls to system.debug
- Test methods and test classes
What is Suite Manager?
Suite Manager is used to create or delete test suites or edit which classes your test suite contains.
A test suite is a collection of Apex test classes that you run together.
Suite Manager is only used to bundle test classes, not to create or edit them directly.
What does runAs() enforce and not enforce in regards to user access?
- Record sharing settings
- Does NOT enforce user permissions, object settings, or field level security!
- It ignores user license limits
- Can be used with new or existing users
What is a debug level?
A set of log levels for debug log categories
- You can reuse debug levels across your trace flags
What is the Log Inspector?
A context-sensitive execution viewer that shows the source of an operation, what triggered the operation, and what occurred afterward.
Use this tool to inspect debug logs that include database events, Apex processing, workflow, and validation logic.
What information can the Log Inspector contain?
- Stack Tree
- Execution Stack
- Execution Log
- Source
- Variables & Execution Overview
Difference between AsyncApexJob and CronTrigger objects when using a SOQL query to obtain information about a scheduled job?
AsyncApexJob uses “Status”, CronTrigger uses “State”
How often can Partial Copy and Full Copy sandboxes be refreshed?
- Partial copy = 5 days
- Full copy = 29 days
What information does the Checkpoints tab provide?
- Namespace
- Class
- Line
- Time (DateTime)
What type of sandbox should be used for quality assurance tasks like user acceptance testing, integration testing, and training?
Partial Copy
What type of sandbox should be used for performance testing, load testing, and staging?
Full Copy