sf-testing
jaganpro/sf-skills
Run Apex tests, analyze coverage, and fix failures with structured test-fix loops.
What is sf-testing?
sf-testing handles Apex unit test execution, code coverage analysis, and test failure diagnosis. Use it when running tests, checking coverage, fixing test failures, or working with *Test.cls files in Salesforce projects.
- Execute Apex tests via sf apex run test with configurable scope (single class, methods, suite, or local)
- Analyze code coverage results and identify uncovered lines and weak coverage areas
- Diagnose test failures by interpreting exception types, stack traces, and assertion outcomes
- Run disciplined test-fix loops: narrow debugging first, then widen regression testing
- Score test suite quality across 6 categories with 120-point scale to assess production readiness
How to install sf-testing
npx skills add https://github.com/jaganpro/sf-skills --skill sf-testingHow to use sf-testing
- 1.Identify the test scope: single test class, specific methods, entire suite, or local tests only
- 2.Run the smallest useful test set first using sf apex run test with your target org alias
- 3.Analyze the results: check pass/fail status, coverage percentage, and any exception messages
- 4.For failures, examine the stack trace and determine if the issue is bad test data, brittle assertions, or broken production code
- 5.Delegate code fixes to sf-apex if needed, then add or improve tests and rerun focused tests before broader regression
- 6.Widen the test scope only after fixes are stable; report test run, pass/fail summary, coverage result, root causes, and next steps
Use cases
- Debug a failing Apex unit test by running a focused test class and analyzing the stack trace
- Improve code coverage on a production class by identifying uncovered lines and writing targeted tests
- Run a full test suite before deployment to ensure no regressions
- Validate bulk behavior (251+ records) and async code paths with proper Test.startTest/stopTest pairing
- Assess overall test suite maturity using the 120-point scoring system
- Salesforce developers writing and maintaining Apex unit tests
- QA engineers validating test coverage before releases
- Development teams enforcing code quality gates and coverage thresholds
sf-testing FAQ
Use sf-testing for running tests, analyzing coverage, and diagnosing failures. Use sf-apex when you need to write or refactor production Apex code or author new test code.
The skill scores test suite quality across 6 categories. Scores 108+ indicate strong production-grade confidence, 96–107 is good with minor gaps, 84–95 is acceptable but needs strengthening, and below 84 is below standard.
No. The skill defaults to SeeAllData=false to ensure tests are isolated and repeatable. Use test data factories or @TestSetup methods instead.
Pair Test.startTest() with Test.stopTest() to properly handle async execution and callout mocking. The skill guides you through these patterns.
Avoid hiding org dependencies inside tests. Use factories and @TestSetup to create reliable, self-contained test data instead.
Full instructions (SKILL.md)
Source of truth, from jaganpro/sf-skills.
name: sf-testing description: > Apex test execution, coverage analysis, and test-fix loops with 120-point scoring. TRIGGER when: user runs Apex tests, checks code coverage, fixes failing tests, or touches *Test.cls / *_Test.cls files. DO NOT TRIGGER when: writing Apex production code (use sf-apex), Agentforce agent testing (use sf-ai-agentforce-testing), or Jest/LWC tests (use sf-lwc). license: MIT metadata: version: "1.1.0" author: "Jag Valaiyapathy" scoring: "120 points across 6 categories"
sf-testing: Salesforce Test Execution & Coverage Analysis
Use this skill when the user needs Apex test execution and failure analysis: running tests, checking coverage, interpreting failures, improving coverage, and managing a disciplined test-fix loop for Salesforce code.
When This Skill Owns the Task
Use sf-testing when the work involves:
sf apex run testworkflows- Apex unit-test failures
- code coverage analysis
- identifying uncovered lines and missing test scenarios
- structured test-fix loops for Apex code
Delegate elsewhere when the user is:
- writing or refactoring production Apex → sf-apex
- testing Agentforce agents → sf-ai-agentforce-testing
- testing LWC with Jest → sf-lwc
Required Context to Gather First
Ask for or infer:
- target org alias
- desired test scope: single class, specific methods, suite, or local tests
- coverage threshold expectation
- whether the user wants diagnosis only or a test-fix loop
- whether related test data factories already exist
Recommended Workflow
1. Discover test scope
Identify:
- existing test classes
- target production classes
- test data factories / setup helpers
2. Run the smallest useful test set first
Start narrow when debugging a failure; widen only after the fix is stable.
3. Analyze results
Focus on:
- failing methods
- exception types and stack traces
- uncovered lines / weak coverage areas
- whether failures indicate bad test data, brittle assertions, or broken production logic
4. Run a disciplined fix loop
When the issue is code or test quality:
- delegate code fixes to sf-apex when needed
- add or improve tests
- rerun focused tests before broader regression
5. Improve coverage intentionally
Cover:
- positive path
- negative / exception path
- bulk path (251+ records where appropriate)
- callout or async path when relevant
High-Signal Rules
- default to
SeeAllData=false - every test should assert meaningful outcomes
- test bulk behavior, not just single-record happy paths
- use factories /
@TestSetupwhen they improve clarity and speed - pair
Test.startTest()withTest.stopTest()when async behavior matters - do not hide flaky org dependencies inside tests
Output Format
When finishing, report in this order:
- What tests were run
- Pass/fail summary
- Coverage result
- Root-cause findings
- Fix or next-run recommendation
Suggested shape:
Test run: <scope>
Org: <alias>
Result: <passed / partial / failed>
Coverage: <percent / key classes>
Issues: <highest-signal failures>
Next step: <fix class, add test, rerun scope, or widen regression>
Cross-Skill Integration
| Need | Delegate to | Reason |
|---|---|---|
| fix production code or author tests | sf-apex | code generation and repair |
| create bulk / edge-case data | sf-data | realistic test datasets |
| deploy updated tests | sf-deploy | rollout |
| inspect detailed runtime logs | sf-debug | deeper failure analysis |
Reference Map
Start here
- references/cli-commands.md
- references/test-patterns.md
- references/testing-best-practices.md
- references/test-fix-loop.md
Specialized guidance
Score Guide
| Score | Meaning |
|---|---|
| 108+ | strong production-grade test confidence |
| 96–107 | good test suite with minor gaps |
| 84–95 | acceptable but strengthen coverage / assertions |
| < 84 | below standard; revise before relying on it |
Related skills
More from jaganpro/sf-skills and the wider catalog.

sf-vlocity-build-deploy
>

sf-ai-agentforce
>

sf-ai-agentforce-observability
>

sf-ai-agentforce-persona
>

transitions-dev
Production-ready CSS transitions for web apps. Use when implementing notification badges, dropdowns, modals, panel reveals, page transitions, card resizes, number pop-ins, text swaps, icon swaps, success checks, avatar group hovers, or error state shakes. Triggers on "add a transition", "animate the dropdown", "make the modal open smoothly", "swap icon", "page slide", "stagger animation", "open / close transition", "make it animate", "tween the size", "fade between", "smooth open", "smooth close", "success animation", "checkmark animation", "confirmation animation", "form error", "shake on invalid", "validation feedback", "hover lift", "avatar stack hover", "chip group hover".

transitions-dev
Production-ready CSS transitions for web apps—21 portable, namespaced snippets with motion tokens.