Neotest adapter for dotnet
- Based on the VSTest for dotnet allowing test functionality similar to those found in IDEs like Rider and Visual Studio.
- Will use the new Microsoft.Testing.Platform when available for newer projects.
- Supports all testing frameworks.
- DAP strategy for attaching debug adapter to test execution.
- Supports
C#
andF#
. - No external dependencies, only the
dotnet sdk
required. - Can run tests on many groupings including:
- All tests
- Test projects
- Test files
- Test all methods in class
- Test individual cases of parameterized tests
neotest-vstest makes a number of assumptions about your environment:
- The
dotnet sdk
, and thedotnet
cli executable in the users runtime path. - (For Debugging)
netcoredbg
is installed andnvim-dap
plugin has been configured fornetcoredbg
(see debug config for more details) - (recommended) treesitter parser for either
C#
orF#
allowing run test in file functionality. neovim v0.10.0
or later
{
"nsidorenco/neotest-vstest"
}
require("neotest").setup({
adapters = {
require("neotest-vstest")
}
})
The adapter optionally supports extra settings:
require("neotest").setup({
adapters = {
require("neotest-vstest")({
-- Path to dotnet sdk path.
-- Used in cases where the sdk path cannot be auto discovered.
sdk_path = "/usr/local/dotnet/sdk/9.0.101/",
-- table is passed directly to DAP when debugging tests.
dap_settings = {
type = "netcoredbg",
}
-- If multiple solutions exists the adapter will ask you to choose one.
-- If you have a different heuristic for choosing a solution you can provide a function here.
solution_selector = function(solutions)
return nil -- return the solution you want to use or nil to let the adapter choose.
end
})
}
})
- Install
netcoredbg
to a location of your choosing and configurenvim-dap
to point to the correct path
This adapter uses that standard dap strategy in neotest
. Run it like so:
lua require("neotest").run.run({strategy = "dap"})
- Issafalcon for the original neotest-dotnet adapter which inspired this adapter.
- Wayne Bowie for helping test and troubleshoot the adapter.
- Dynge for testing and contributing to the adapter.