Testing Apex Code
In the chapters so far, we have discussed a number of ways in which we can efficiently stop, debug, and capture errors within our applications to make them more robust and scalable. In this chapter, we will discuss Apex testing, which is a key part of any application’s development as it is the earliest opportunity that a developer gets to capture errors and avoid exceptions occurring in an ongoing manner.
In this chapter, we will discuss the following topics:
- Understanding the importance of testing as a practice when developing Apex code
- The Test Data Factory pattern and the benefits of this pattern in developing test data
- Loading in test data using the
Test.loadData
method and the benefits this provides - Using static resources to simplify testing web service callouts
- Testing best practices