Apex test execution & coverage: disciplined run, score and fix loops for Salesforce tests
Run Apex tests via sf CLI with a 120-point scoring rubric, high-signal rules (SeeAllData=false, 251+ record bulk tests), failure-analysis workflows and test templates
- What
- Run Apex tests via sf CLI with a 120-point scoring rubric, high-signal rules (SeeAllData=false, 251+ record bulk tests), failure-analysis workflows and test templates
- Cost
- Free
- Needs
- access to a Salesforce org (Dev org is free) with permission to run tests, and the sf CLI (≥2.0), plus jq and python3 for the helper script
- Install
- Copy the installer prompt below into your Muse — your agent does the rest.
Curated by Skill Harbor — the official @forcedotcom skill for Apex test execution and coverage analysis: running tests, diagnosing failures, improving coverage, and managing a disciplined test-fix loop for Salesforce code. The workflow goes discover test scope → run the smallest useful set first → analyze (failing methods, exception types, uncovered lines, whether failures mean bad test data, brittle assertions, or broken production logic) → disciplined fix loop → intentional coverage improvement (positive, negative/exception, bulk with 251+ records to cross the 200-record trigger batch boundary, callout/async paths). High-signal rules: default to `SeeAllData=false` for test isolation, every test must assert meaningful outcomes, pair `Test.startTest()` with `Test.stopTest()` for async, never hide flaky org dependencies inside tests. Output format is fixed (what ran → pass/fail summary → coverage → root causes → fix or next-run recommendation), and every run is scored on a 120-point rubric (108+ = strong production-grade confidence, <84 = below standard). Ships with reference files (CLI commands, test patterns, best practices, fix-loop decision tree, mocking and performance guides), test-class templates (basic, bulk, mock callout, data factory, DML mock, StubProvider), and a `parse-test-results.py` hook script for the auto-fix loop. Delegates cleanly: production code to platform-apex-generate, LWC/Jest to experience-lwc-generate, Agentforce testing to agentforce-test. Honest caveats: requires a Salesforce org and the `sf` CLI (≥2.0) with access rights — you bring your own org; it never writes production code (it hands that to the companion generate skill). Apache-2.0. Skill Harbor never reviews the code, review it yourself before use. Discovered via skills.sh.
Version:
Install
Prerequisites: access to a Salesforce org (Dev org is free) with permission to run tests, and the sf CLI (≥2.0), plus jq and python3 for the helper script Install "Apex test execution & coverage: disciplined run, score and fix loops for Salesforce tests" for me. It gives my agent the official Salesforce skill for running Apex tests via `sf apex run test`: scope discovery, smallest-useful-set-first runs, failure analysis (failing methods, exception types, uncovered lines, bad test data vs brittle assertions vs broken logic), disciplined test-fix loops, intentional coverage improvement (positive, negative, 251+ record bulk, callout/async paths), high-signal rules (SeeAllData=false default, meaningful assertions, Test.startTest()/stopTest() pairing), fixed output format, and 120-point scoring of every run — plus test templates and a results-parsing hook script. Delegates production code fixes to platform-apex-generate. Apache-2.0. Repository: https://github.com/forcedotcom/sf-skills/blob/main/plugins/builder/salesforce-development/skills/platform-apex-test-run/SKILL.md 1. Fetch the SKILL.md file (and any helper files) from the repository path into a temporary folder and summarize what it does in one or two sentences. 2. Safety check: review the SKILL.md and scripts for anything suspicious (unexpected network calls, shell commands, credential harvesting). This repo should contain zero secrets in code, credentials only via the secure vault, allowed hosts declared in the SKILL.md. Verify that holds here; STOP on any red flag and tell me. 3. Install it as a skill: copy SKILL.md and its helper files into the agent's skills directory, in a folder named "platform-apex-test-run". 4. Verify with no network calls: frontmatter valid, files in place. 5. Report what was installed, where, and what I still need to do myself (e.g. authenticate the sf CLI against my org with `sf org login web`, then ask the agent to run and analyze your Apex tests). GitHub is optional: if I have a GitHub account or the gh CLI, you may use it; otherwise public access is fine. Never require it unless it's in the prerequisites above. Rules: don't touch anything outside the temp folder and the install target. If anything looks off, stop and ask me.
Questions
How do I install a build?
Every product page includes a copy-paste install prompt. Paste it into your Muse and it sets the build up for you — no manual configuration.
Where does my money go?
Straight to the seller. Skill Harbor never processes payments: checkout happens on the seller’s own page, usually Stripe.
What does the ✓ next to a creator’s name mean?
It means we confirmed the identity of the person behind the listing. It says nothing about the code itself — always check a build before installing it.