Published
- 2 min read
Salesforce Apex Unit/E2E Samples
Check out the source code! - https://github.com/tooniez/salesforce-apex-testing
Salesforce Apex Common Test Suite
This repository houses a collection of Apex test classes, designed to validate the functionality and reliability of a Salesforce application. We use the sfdx-lwc-jest
library to run our unit tests.
Common Test Classes
The common test classes included in this directory under scripts/apex/
are designed to test various aspects of the Salesforce application. They include:
Unit Tests
- Object Test Classes: These test classes are used to verify the behavior of custom objects in the application. They ensure that all object fields and methods function as expected.
- Trigger Test Classes: These test classes are used to test the triggers in the application. They ensure that the triggers execute correctly under various conditions.
- Controller Test Classes: These test classes are used to test the controllers in the application. They ensure that the controllers correctly manage the flow of data between the views and the model.
- Batch Job Test Classes: These test classes are used to test batch jobs in the application. They ensure that the batch jobs correctly process large volumes of data.
- Utility Test Classes: These test classes are used to test various utility classes in the application. They ensure that the utility classes correctly perform their intended functions.
E2E User Flows
- User Flow Test Classes πΆββοΈ: These classes simulate a userβs journey through the application, testing end-to-end functionality. They include:
- User Registration Flow Test Class
- User Login Flow Test Class
- Data Entry Flow Test Class
- Data Retrieval Flow Test Class
- User Profile Update Flow Test Class
- Data Update Flow Test Class
- Data Deletion Flow Test Class
- Search Functionality Flow Test Class
Configure
The sfdx-project.json
file contains configuration information for your project.
{
"packageDirectories": [
{
"path": "force-app",
"default": true
}
],
"name": "salesforce-apex-testing",
"namespace": "",
"sfdcLoginUrl": "https://login.salesforce.com",
"sourceApiVersion": "58.0"
}
Vscode
Includes a .vscode
extension and debugging for Salesforce development in VS Code.
Usage
- Clone this repository
- Install dependencies with
npm install
- Run Apex unit tests with
npm run test:unit
More Info
See Salesforce DX Project Configuration in the Salesforce DX Developer Guide for details about this file. Do you want to deploy a set of changes, or create a self-contained application? Choose a development model.