8

So in 1.59 of vscode "Native support for running tests in VS Code with built-in Test Explorer." was added (https://code.visualstudio.com/updates/v1_59).

My question is, how on earth do I use it? I can find tonnes of resources on how to do it with 3rd party extensions, and in fact in the release notes linked above it namechecks the "Test Explorer UI" (https://marketplace.visualstudio.com/items?itemName=hbenl.vscode-test-explorer). However that says it is now depreciated due to the aforementioned native implementation. Even then if I install it, I get an icon but no tests underneath. If I follow what little docs I have in those release notes "get the native experience by setting testExplorer.useNativeTesting to true" the icon disappears and I'm back to square one.

Maybe its an expectation vs reality thing, I'm using .net-core, and if I setup a project like so:

dotnet new sln
dotnet new classlib --name MyCode
dotnet new xunit --name MyCode.Tests
dotnet sln add MyCode MyCode.Tests

And open it in VSCode, other than installing the C# extension. What else could it possibly need?

Please note, I know I can install yet another extension (.NET Core Test Explorer - Jun Han) but this seems to totally circumvent the native explorer.

Thanks in Advance.

5
  • 2
    There is a blog post about it here: jpearson.blog/2021/09/01/test-explorer-in-visual-studio-code in which it states "Using the Test Explorer is pretty self-explanatory if you’ve already been using AL Test Runner." - It isn't, and AL Test Runner doesn't work. Commented May 11, 2022 at 8:01
  • just as you have to load extensions for your language to run tests in Test Explorer UI, you now also have to have extension that use the buildin Test Explorer API, find one in the Market place for your language or write one yourself
    – rioV8
    Commented May 11, 2022 at 11:38
  • Hi @rioV8, Do you have any documentation that states this? The only extension I can find that is even remotely applicable is this marketplace.visualstudio.com/…, which hasn't been updated in 2 years, and that says it requires the now depreciated Test Explorer UI? Commented May 12, 2022 at 7:45
  • what is the last link in the first paragraph about the Testing API in the v1.59 updates page. VSC Testing API is just a UI frontend for a Testrunner, VSC has no knowledge of all the Testrunners, You write a middleware that interfaces both API's, The same as with the Debugger in VSC
    – rioV8
    Commented May 12, 2022 at 8:20
  • Have the same issue, been trying to get it to work but there is no documentation, barely an article about it (except the jpearson one mentioned above) and it's therefore unclear what I need to do to get it working. Extensions which appear to be used with it are deprecated in favour of using Text Explorer, which is where I started. Seems like a non-feature based on my experience so far.
    – wlf
    Commented Jul 11, 2022 at 5:52

1 Answer 1

1

I had the same issue. Based on my research and understanding of the docs, the addition to VS Code 1.59+ is apparently ONLY an API that third-party extensions can use.

Last fall we began work on adding native support for running tests in VS Code, and this month the first set of testing-related APIs has been finalized.

There doesn't seem to be any built-in interface, although the docs reference a "built-in Test Explorer" which has made it very confusing. "Test Explorer" is actually the third-party extension. There is apparently no native interface.

Based on this reddit thread, I installed MSTest V2 as a NuGet package (dotnet add package MSTest.TestFramework) and then Jun Han's extension for the test interface. I think otherwise you'd have to use the dotnet test command in the CLI interface.

I wish the MS docs would clarify what they mean by built-in test explorer. I spent half my morning on this!

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.