aer
Local Apex Development and Testing
aer (Apex Execution Runtime) is an Apex interpreter and test runner. Run and test Apex code locally without deploying to Salesforce, dramatically speeding up your development workflow.
Key Features
- Local Execution - Run Apex code on your machine without Salesforce deployment
- Fast Testing - Execute unit tests in milliseconds instead of seconds
- CI/CD Integration - Run tests in continuous integration pipelines
- Standard Library - Full support for List, Map, Set, String, Date, JSON, HTTP, and more
- Interactive Debugging - Set breakpoints in VS Code and inspect Apex state live
Basic Usage
# Run all tests in the SFDX source tree
aer test force-app/main/default
# Filter tests by class or method name
aer test force-app/main/default --filter AccountTest
# Execute anonymous Apex (or pipe code via stdin)
aer exec "System.debug('Hello, World');"Interactive Debugging
Pair aer with the bundled aer Local Apex Debugger extension for VS Code to step through tests, inspect locals, and evaluate expressions without leaving your editor. Run aer test --debug force-app/main/default/classes once and the CLI will install the extension (if needed), write .vscode/launch.json for you, and open VS Code with a ready-made configuration like this:
{
"type": "aer",
"request": "launch",
"name": "Debug Apex Tests",
"aerPath": "/path/to/aer",
"stopOnEntry": true,
"args": [
"force-app/main/default/classes"
]
}You do not need to edit launch.json by hand; rerun aer test --debug with new flags whenever you want to regenerate the configuration.
Start a debug session from the Run and Debug view (F5) and set breakpoints anywhere in your Apex tests. See Interactive Debugging → for a full walkthrough, including attach mode and troubleshooting tips.
Packaging
# Create a package from Apex source
aer package create --output packages/app.pkg force-app/main/default
# Inspect package contents
aer package list packages/app.pkg
# Generate a package file from an installed managed package
aer package mock MyNamespace --account myorg --output packages/MyNamespace.pkg
# Load package dependencies when running locally
aer test force-app/main/default --package packages/app.pkg
aer exec --path force-app/main/default --package packages/app.pkg "System.debug(MyClass.myMethod());"
# Use a directory of packages instead of individual flags
aer test force-app/main/default --package-dir ./packagesGetting Started
Docs
Subscribe
Choose a plan on the pricing page.
Use Cases
- Rapid Development - Test Apex logic locally without deployment delays
- CI/CD Pipelines - Fast, parallel test execution in continuous integration
- Learning Apex - Experiment with Apex without a Salesforce org
- Code Analysis - Static analysis and validation of Apex codebases
- Multi-Package Development - Test code depending on multiple managed packages
Language Support
- Core Features - Classes, methods, properties, constructors, inheritance, interfaces
- Collections - List, Map, Set with full method support
- Control Flow - If/else, loops, try/catch/finally, switch statements
- DML Operations - Insert, update, delete, undelete with Database class
- SOQL - Query support with WHERE, ORDER BY, LIMIT, relationships
- Declarative - Flows, validation rules, formula fields, lookup filters, sharing rules
- Testing - @IsTest annotations, Test.startTest(), assert methods, HttpCalloutMock
- Standard Library - String, Math, Date, Datetime, Decimal, JSON, Crypto, Pattern, HTTP, Limits, XML, Compression, DOM, Url, Approval, PageReference
- DataWeave - DataWeave script execution