Back to Blog

Introducing LATdx

LATdx runs Salesforce Apex tests from your project, reuses eligible cached results, and helps you focus on tests affected by code changes.

Updated 2 min read

A shorter Apex test feedback loop

LATdx is a CLI for running Salesforce Apex tests from an SFDX project. It can reuse results for unchanged tests and select tests affected by a code change, so you can get focused feedback while developing. You still choose when to run the full suite.

Run your first test suite

Install the CLI on macOS or Linux:

Install
curl -fsSL https://latdx.com/install.sh | bash

Authenticate the Salesforce CLI to your org, then run this from the directory containing sfdx-project.json:

Shell
latdx test run -o my-org

The first run executes the selected tests against the org. A later run can replay unchanged results from the local cache. Follow the CLI quickstart for Windows installation, prerequisites, and sign-in details.

Reuse results with care

With Java 11 or newer and the LATdx daemon, the cache keys each test result to the Apex it reaches through static calls and your project's object and tracked metadata files; without them, keys cover the test class's own code. It does not snapshot the org's schema. A changed input triggers a fresh run. Tests marked @IsTest(SeeAllData=true) always run fresh. See the test caching guide for cache behavior and controls.

Tests run against the code deployed to the org, not your local files. Deploy a local edit before you run the tests that depend on it: a run made first stores the old code's result under the edited code's fingerprint.

Static analysis also cannot follow every dynamic Apex call, such as a class name passed to Type.forName, so a change to code reached that way does not invalidate stored results. In both cases, refresh the stored results with --force: name the tests with -n (classes) or -t (Class.method), or run the full suite without --affected:

Shell
latdx test run -o my-org --force

--no-cache skips the cache for one run but leaves the old results stored.

Focus a run on changed code

For a Git change, --affected narrows the run to tests whose static reach includes a changed Apex class:

Shell
latdx test run --affected -o my-org --base origin/main

Add --dry-run to print the selected tests, one per line, without running anything. The list is ready to pass to sf apex run test --tests.

Shell
latdx test run --affected -o my-org --base origin/main --dry-run

Some changes can affect tests without a static call graph edge, including objects and fields, triggers, flows, labels, and permission metadata. Run the full suite with --force when these change. The CLI reference lists the other change types that need a full-suite run.

Try it on your own suite

One line installs the CLI. Then point latdx test run at your org.

curl -fsSL https://latdx.com/install.sh | bash