Skip to Content
CLICommand ReferenceTesting & Quality

Testing & Quality


sfdt test

Runs Apex tests against the configured org using the enhanced test runner. If tests fail and AI is enabled, sfdt offers to analyze the failures. Results land in logs/test-results/ and the dashboard.

sfdt test sfdt test --analyze sfdt test --legacy sfdt test --dry-run
OptionDescription
--legacyUse the legacy test runner instead of the enhanced one
--analyzeRun the test analyzer after tests complete, regardless of pass/fail
--dry-runPreview without running

AI on failure: when tests fail and AI is available, sfdt prompts to analyze the failures — it checks for missing test data, SOQL governor-limit violations, null-pointer exceptions, and assertion failures, then suggests specific fixes. Set features.ai: false to skip the prompt.


sfdt quality

Static code-quality analysis with optional AI fix plan. Can analyze code structure, test quality, or both.

sfdt quality # code analyzer only (default) sfdt quality --tests # test analyzer only sfdt quality --all # both analyzers sfdt quality --fix-plan # analyzer + AI fix plan sfdt quality --generate-stubs # generate @IsTest stubs for untested Apex sfdt quality --generate-stubs --dry-run # preview stubs without writing files
OptionDescription
--testsRun the test analyzer only
--allRun both the code and test analyzers
--fix-planSend analysis output to AI for a prioritized, file-specific fix plan
--generate-stubsGenerate @IsTest stub classes for Apex without a test class
--dry-runPreview --generate-stubs output without writing files

The AI fix plan groups issues by severity (critical / high / medium / low) with file locations and concrete suggestions, focused on Salesforce concerns: governor limits, CRUD/FLS, bulk-safe patterns, and coverage gaps.


sfdt changelog

Manages changelog files. Three subcommands. All accept --package <name> to scope to a package changelog (changelogs/<name>.md); without it, they operate on the global CHANGELOG.md.

sfdt changelog generate

Uses AI to analyze recent git commits and generate [Unreleased] entries, categorized into Added / Changed / Fixed / Deprecated / Removed / Security.

sfdt changelog generate sfdt changelog generate --limit 30 sfdt changelog generate --package marketing
OptionDescription
--limit <n>Number of commits to analyze (default 20)
--package <name>Scope to a package changelog

Requires features.ai: true.

sfdt changelog release

Moves the [Unreleased] section to a new versioned section stamped with the current date. Edits in place; does not commit.

sfdt changelog release 1.5.0 sfdt changelog release 1.5.0 --package marketing
Argument / OptionDescription
<version>Semver version (X.Y.Z)
--package <name>Target a package changelog

sfdt changelog check

Validates that the changelog is in sync with git state — warns if you have uncommitted changes but an empty [Unreleased]. Exits 1 if the changelog needs updating, so it works as a CI gate.

sfdt changelog check sfdt changelog check --package marketing
Last updated on