vscode-swift icon indicating copy to clipboard operation
vscode-swift copied to clipboard

"Run Test" gutter icon does not show "in-progress" icon when Swift Testing test are demanded

Open bkhouri opened this issue 1 year ago • 1 comments

Describe the bug When selecting the "Run/Debug Test" from the VSCode gutter, the gutter icon is not updated to "In Progress" icon when a Swift Testing test is selected.

To Reproduce Steps to reproduce the behavior:

  1. Open a file that has Swift Testing test case
  2. Click on the "Run Test" gutter icon
  3. Notice the gutter icon remain the "Play" icon until the test result is available

Another Reproduction steps:

  1. Checkout https://github.com/swiftlang/swift-package-manager/pull/8099
  2. Open VSCode
  3. Navigate to file Tests/_InternalTestSupportTests/PlatformHelpersTests.swift
  4. Select "Run Test" or "Run Suite" gutter.and wait...

Expected behavior Once the "Run Test" or "Run Suite" gutter icon was selected, the button icon is update to in indicate the request was put in the queue.

Actual behavior When selecting the Gutter icon, there is no indication from the gutter icon to indicate what is happening. As a user, I'm left wondering if VSCode is processing the request or not. I tend to click the Gutter icon numerous times, only to then discover the status bar indicating there is a build activity - in which I assume is related to building my tests. The gutter icon is only updated once the test results are available.

Environment

  • OS: macOS
  • Swift version (output of swift --version)
  • Visual Studio Code version:
    Version: 1.95.3 (Universal)
    Commit: f1a4fb101478ce6ec82fe9627c43efbf9e98c813
    Date: 2024-11-13T14:50:04.152Z
    Electron: 32.2.1
    ElectronBuildId: 10427718
    Chromium: 128.0.6613.186
    Node.js: 20.18.0
    V8: 12.8.374.38-electron.0
    OS: Darwin arm64 24.2.0
    
  • vscode-swift version: v1.11.3

Additional context See the attached screen recording for the behaviour

  • https://github.com/user-attachments/assets/6cc4a38b-4b80-4d22-b69d-0574358196ce

bkhouri avatar Nov 21 '24 17:11 bkhouri

A little explanation for why this is an issue. The VS Code APIs require test runs to have all their tests specified at creation time. Because swift testing has parameterized tests, we can’t know this full list until the build completes and swift testing starts and provides us with all the individual test cases generated at run time.

Ultimately this means that we must delay creating the VS Code test run when swift testing tests are involved until after the build. This means the icon wont update when running swift testing tests until potentially much later than with XCTest test runs.

If VS Code allowed for dynamically updating the list of tests in a test run then we could make this just as smooth as XCTest.

plemarquand avatar Nov 21 '24 18:11 plemarquand