The Apex Testing Module teaches how to write code in order to execute Salesforce Apex tests. It requires coding or programming knowledge and experience. The module is divided into 3 units
Unit 1 – Get Started with Apex Unit Tests (Duration – 15 minutes)
After going through this first unit of the module, you should be able to define what are Apex unit tests and the key benefits. You will learn how to use test methods to define a class and execute them in order to inspect failures. You’ll also be creating and executing test class suites in this unit. The testing framework of Salesforce Apex enables writing and executing tests via the Lightning Platform using Apex triggers and classes.
Unit 2 – Test Apex Triggers (Duration – 15 minutes)
This unit teaches you how to code test for an Apex trigger that will fire on a given single record operation. Prior to deploying the trigger, you should code unit tests that will perform actions that activate the trigger and confirm the expected results. You’ll start with testing a trigger that you worked on in an earlier module called titled Writing Apex Triggers. If the account record has corresponding opportunities, the AccountDeletion trigger will then prevent the deletion of the record.
You’ll also learn how to execute any test method in a class. You’ll begin by adding the test method. This test method will verify the functionalities of the trigger which will then prevent the deletion of an account if there are related opportunities.
Unit 3 – Create Test Data for Apex Tests (Duration – 15 minutes)
The unit begins with creating a test utility class. You will learn how to use this class to include reusable methods for your test data setup. You should be familiar now with testing Apex triggers as discussed in a previous unit. You also learn how to utilize how to configure test data to be used in different test cases using a test utility method which greatly enhance the capabilities of Salesforce Apex.