Skip to content

feat(apex-testing): new command SFDX: Edit Apex Test Suite that includes add and remove functionality - W-23257457#7672

Draft
peternhale wants to merge 25 commits into
developfrom
phale/W-23257457-unified-edit-command
Draft

feat(apex-testing): new command SFDX: Edit Apex Test Suite that includes add and remove functionality - W-23257457#7672
peternhale wants to merge 25 commits into
developfrom
phale/W-23257457-unified-edit-command

Conversation

@peternhale

@peternhale peternhale commented Jul 2, 2026

Copy link
Copy Markdown
Contributor

What does this PR do?

Adds Apex Test Suite editing support — the ability to add and remove tests from a suite
directly from VS Code — and delivers it as a single unified "Edit Apex Test Suite"
command (sf.apex.test.suite.edit).

Phase 1 — Remove Tests from Apex Test Suite:

  • Implemented apexTestSuiteRemove: queries current TestSuiteMembership records, presents
    a multi-select quick pick of current members, removes selected classes via Tooling API
  • Tooling API deletes TestSuiteMembership records individually (batch endpoint unsupported)
  • Used Effect.tryPromise for all tooling calls so rejections surface as typed errors
  • Graceful handling when no suites exist or a suite is empty (info message instead of
    silent cancellation)
  • Added E2E coverage, docs, and i18n (English + Japanese)

Phase 2 — Unify add/remove into a single Edit command:

  • Replaced sf.apex.test.suite.add and sf.apex.test.suite.remove with
    sf.apex.test.suite.edit
  • New UX: multi-select picker showing all test classes with current suite members
    pre-checked; toggling adds or removes in one step
  • gatherEditOptions() queries suite membership and all ApexClasses in parallel, uses
    ApexClass ID matching to correctly pre-check existing members
  • applyEdits() handles add/remove as parallel Tooling API operations
  • Updated command registration, i18n, E2E specs, README, and walkthrough docs

Also includes:

  • Fixed pre-existing lint warnings in salesforcedx-apex (Function → proper signatures,
    import order in logService.ts)
  • Added fileSystemHandler.ts to knip ignore list (false positive)

What issues does this PR fix or reference?

@W-23257457@

Functionality Before

No way to remove tests from a suite in VS Code. Adding tests required a separate "Add Tests
to Apex Test Suite" command with no visibility into current membership.

Functionality After

Single "SFDX: Edit Apex Test Suite" command. Multi-select picker shows all test classes with
current suite members pre-checked — check/uncheck to add or remove in one operation.

Testing

  • No Apex test suites available -> "No Apex test suites found." info notification ✅
  • Create Apex test suite ✅
  • Be able to check boxes to add tests to a test suite ✅
  • Be able to uncheck boxes to remove tests from a test suite ✅
  • Remove all tests such that you end up with an empty test suite ✅
  • Do both adding and removing Apex tests in one run of the edit suite command ✅
  • Click "OK" with no changes to the selection ✅
  • Try to run empty Apex test suite (now possible after removing all tests from the suite) -> get error notification saying there's nothing to run ✅
  • Cancellation when selecting suite by clicking in the Editor View ✅
  • Cancellation when selecting tests by clicking in the Editor View ✅

daphne-sfdc and others added 19 commits June 30, 2026 18:31
Co-Authored-By: Claude Sonnet 4.6 (1M context) <noreply@anthropic.com>
…d - W-23257457

Co-Authored-By: Claude Sonnet 4.6 (1M context) <noreply@anthropic.com>
…on activation - W-23257457

Co-Authored-By: Claude Sonnet 4.6 (1M context) <noreply@anthropic.com>
…23257457

Co-Authored-By: Claude Sonnet 4.6 (1M context) <noreply@anthropic.com>
…aveResult, fix test assertions

- Convert Effect.promise to Effect.tryPromise for tooling.query and tooling.delete
  calls so rejections become typed errors instead of unrecoverable defects
- Inspect SaveResult[] from tooling.delete to detect partial failures
- Show informational message when suite is empty instead of silent cancellation
- Replace brittle textContent() snapshot in E2E with retry-capable assertion
- Use panel-scoped locator for tree absence check instead of page-scoped
- Replace notificationService wrapper with direct vscode.window call
- Use flatMap instead of map+filter for RemovableClassItem construction

Co-Authored-By: Claude Sonnet 4.6 (1M context) <noreply@anthropic.com>
Tighten verbose prose to fragment style per concise skill.
Add missing check:dupes verification step.

Co-Authored-By: Claude Sonnet 4.6 (1M context) <noreply@anthropic.com>
…r Tooling API

The Tooling API does not support the composite/sobjects batch endpoint that jsforce
routes array deletes through. Switch to Promise.all of individual delete calls.

Co-Authored-By: Claude Sonnet 4.6 (1M context) <noreply@anthropic.com>
…command

Replace separate "Add Tests to Apex Test Suite" and "Remove Tests from Apex Test Suite"
commands with unified "Edit Apex Test Suite" command. New UX shows multi-select picker
with all test classes, current suite members pre-checked. Users check/uncheck to add/remove.

Changes:
- Unified sf.apex.test.suite.add and sf.apex.test.suite.remove into sf.apex.test.suite.edit
- Added gatherEditOptions with proper ApexClass ID matching for pre-checked state
- Added applyEdits to handle parallel add/remove operations
- Updated i18n for English and Japanese
- Updated E2E specs to test unified edit workflow
- Updated documentation (README, walkthrough)

Also includes:
- Fixed pre-existing lint warnings in salesforcedx-apex (Function type → proper signatures)
- Fixed import order in logService.ts
- Added fileSystemHandler.ts to knip ignore list (false positive)

Reduces command palette clutter from 4 suite commands to 3.
@peternhale peternhale requested a review from a team as a code owner July 2, 2026 18:13
@peternhale peternhale requested review from daphne-sfdc and mingxuanzhangsfdx and removed request for mingxuanzhangsfdx July 2, 2026 18:13
@daphne-sfdc daphne-sfdc changed the base branch from daphne/W-23257457-new-command-sfdx-remove-apex-tests-from to develop July 2, 2026 21:02
@daphne-sfdc daphne-sfdc changed the title refactor: unify add/remove commands into single Edit Apex Test Suite command feat(apex-testing): new command SFDX: Edit Apex Test Suite that includes add and remove functionality - W-23257457 Jul 2, 2026
@daphne-sfdc daphne-sfdc marked this pull request as draft July 9, 2026 19:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants