aer

aer

Coming Soon

Local Apex Development and Testing

aer (Apex Execution Runtime) is an Apex interpreter and test runner implemented in Go. 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
  • Schema Support - Import org metadata for accurate type checking
  • Standard Library - Full support for List, Map, Set, String, Date, JSON, HTTP, and more

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 a specific method using source paths
aer run AccountService.run --path force-app/main/default

# Execute anonymous Apex from the flag (or pipe code via stdin)
aer exec force-app/main/default --exec "System.debug('Hello, World!');"

Schema Management

# Fetch schema from Salesforce
aer schema fetch --account myorg --schema schema.gob

# Import metadata for type checking
aer schema import force-app/main/default --schema schema.gob

# List objects in schema
aer schema inspect objects --schema schema.gob

# Show fields for an object
aer schema inspect fields Account --schema schema.gob

Storage

# Create a SQLite database seeded from a schema export
aer storage create --schema schema.gob --db storage/aer.db

# Include package metadata when building the database
aer storage create --schema schema.gob --db storage/aer.db --package packages/managed.pkg

# Reuse the same database when running tests locally
aer test force-app/main/default --db storage/aer.db

# Inspect the tables in an existing SQLite database
aer storage list-tables --db storage/aer.db

API Server

# Start the Salesforce-compatible server (defaults: username aer / password password)
aer server --schema schema.gob --source force-app/main/default --db storage/aer.db --addr 0.0.0.0:8080

# Fetch an OAuth token using the password grant flow
curl -X POST http://localhost:8080/services/oauth2/token \
  -d 'grant_type=password&client_id=aer&client_secret=aer&username=aer&password=password'

# Execute anonymous Apex via the Tooling API
curl -X POST http://localhost:8080/services/data/v60.0/tooling/executeAnonymous \
  -H "Authorization: Bearer ${ACCESS_TOKEN}" \
  -H "Content-Type: application/json" \
  -d '{"anonymousBody": "System.debug(\'Hello from aer\');"}'

Packaging

# Create a package from Apex source
aer package create --output packages/app.pkg --schema schema.gob 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 force-app/main/default --package packages/app.pkg --exec "System.debug('test');"

# Use a directory of packages instead of individual flags
aer test force-app/main/default --package-dir ./packages

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
  • Testing - @IsTest annotations, Test.startTest(), assert methods, HttpCalloutMock
  • Standard Library - String, Math, Date, Datetime, JSON, Crypto, Pattern, HTTP
© 2012–2025 October Swimmer.