platform-apex-test-run

Run Apex tests, analyze code coverage, and fix failing tests in Salesforce orgs.

Updated Jul 2, 2026
One-click install
npx skills add https://github.com/padjei/SF_Build --skill platform-apex-test-run-padjei
Or copy as Structured Prompt for Agent▼
Please help me install this Agent Skill.
Skill: platform-apex-test-run
Source: https://github.com/padjei/SF_Build/tree/main/.claude/skills/platform-apex-test-run
Command: npx skills add https://github.com/padjei/SF_Build --skill platform-apex-test-run-padjei

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) and assets (resource) components.

What problem does it solve? Running Apex tests, interpreting failures, and maintaining code coverage in Salesforce orgs is repetitive and error-prone. This Skill automates test execution via the sf CLI, parses results into structured failure analysis, and drives an agentic test-fix loop until tests pass. ## Core Features & Use Cases - Test Execution & Coverage Analysis: Run single classes, specific methods, suites, or all local tests with sf apex run test, including JSON, JUnit, and detailed line-by-line coverage output. - Failure Analysis & Auto-Fix Loop: Parse failures into root causes (NullPointerException, DmlException, governor limits) with suggested fixes, then re-run focused tests until passing. - Testing Patterns & Templates: Apply test data factories, HttpCalloutMock, DML mocking, StubProvider stubs, and 251-record bulk tests, scored against a 120-point quality rubric. - Use Case: Ask to run all local tests with coverage on a sandbox; the Skill reports pass/fail, identifies a NullPointerException in AccountServiceTest, suggests the missing null check, and re-runs the fixed test. ## Quick Start Ask the assistant to run all local Apex tests with code coverage against your target org and automatically fix any failures it finds.

Frequently Asked Questions about platform-apex-test-run

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I run Apex tests with code coverage using the sf CLI?▼

Run sf apex run test with --class-names for specific tests or --test-level RunLocalTests for all local tests, adding --code-coverage and --result-format json. Use --output-dir to save results and --target-org to specify the org alias.

How do I fix failing Apex tests automatically?▼

Enable the agentic test-fix loop, which parses failure messages, classifies the error type such as NullPointerException or DmlException, suggests a root-cause fix, applies it, and re-runs the focused test. It iterates up to three attempts until tests pass.

Why should Apex bulk tests use 251 records?▼

Triggers process records in batches of 200, so 251 records crosses the batch boundary into a second chunk of 51. This reveals bulkification bugs like DML or SOQL inside loops that single-batch tests miss.

How do I mock HTTP callouts in Apex tests?▼

Implement the HttpCalloutMock interface with a respond method returning a fabricated HttpResponse, then register it with Test.setMock before invoking the code under test. Salesforce requires mocks because real callouts are blocked in tests.

Why does my Apex test fail with uncommitted work pending during a callout?▼

DML and HTTP callouts cannot occur in the same transaction context. Wrap the callout code between Test.startTest and Test.stopTest so the DML commits before the mocked callout executes.

When should I not use this Apex test skill?▼

Use a different skill when writing production Apex code, testing Agentforce agents, or running Jest tests for Lightning Web Components. This skill covers only server-side Apex test execution, coverage, and failure analysis.