Test Explorer UI VSCode

Hi,

Does anybody work on a test explorer ui for elixir ? Something like Rust Test Explorer ?
Thanks

4 Likes

Do you have screenshot how does that tool look like? Or link to it?

Sure, some links

Here the exemple for rust, taken from vscode-rust-test-adapter and

and https://marketplace.visualstudio.com/items?itemName=hbenl.vscode-test-explorer

4 Likes

I’ve been looking for this as well. I don’t think it exists and I’ve looked at some existing adapters and it’s too much work to do it quickly, but I don’t think it would be too hard.
For example looking at https://github.com/connorshea/vscode-ruby-test-adapter gives you some idea of what needs to happen

To be clear, the reason that I would like this, is not that mix test is not sufficient, but this for me really is a case where a gui can be faster to show you all the failures,…

While it would be nice to have a UI, for those who are looking for an integrated testing environment, it is possible to create tasks to run the tests inside VSCode console.

Here is how I do it. Create tasks.json inside .vscode directory

{
  "version": "2.0.0",
  "tasks": [
    {
      "label": "Run test current file",
      "type": "shell",
      "command": "mix",
      "args": [
        "test",
        "${relativeFile}"
      ],
      "presentation": {
        "echo": true,
        "reveal": "always",
        "focus": true,
        "panel": "new"
      }
    },
    {
      "label": "Run test current line",
      "type": "shell",
      "command": "mix",
      "args": [
        "test",
        "${relativeFile}:${lineNumber}"
      ],
      "presentation": {
        "echo": true,
        "reveal": "always",
        "focus": true,
        "panel": "new"
      }
    },
    {
      "label": "Run all tests",
      "type": "shell",
      "command": "mix",
      "args": [
        "test"
      ],
      "presentation": {
        "echo": true,
        "reveal": "always",
        "focus": true,
        "panel": "new"
      }
    },
    {
      "label": "Lint",
      "type": "shell",
      "command": "mix credo",
      "presentation": {
        "echo": true,
        "reveal": "always",
        "focus": true,
        "panel": "new"
      }
    }
  ]
}

And then create keybindings (by using a keybindings.json file inside .vscode or configure globally inside VSCode).

[
  {
    "key": "ctrl+i",
    "command": "workbench.action.tasks.runTask",
    "args": "Run test current file"
  },
  {
    "key": "ctrl+u",
    "command": "workbench.action.tasks.runTask",
    "args": "Run test current line"
  },
  {
    "key": "ctrl+t",
    "command": "workbench.action.tasks.runTask",
    "args": "Run all tests"
  },
  {
    "key": "ctrl+l",
    "command": "workbench.action.tasks.runTask",
    "args": "Lint"
  }
]

The intellij plugin has a tests-GUI.

There is a screenshot in the readme.

I released it a few weeks ago Elixir Test Explorer - Visual Studio Marketplace
Unfortunately, it doesn’t handle umbrella projects yet, but I’m working on that.

3 Likes