alexhokl / nvim-dap-dotnet

MIT License
0 stars 1 forks source link

Launching unit test #1

Open alexhokl opened 11 months ago

alexhokl commented 11 months ago

Unit test can be executed by netcoredbg using the following command.

netcoredbg --interpreter=cli -- dotnet test Some.Tests.dll

The problem is to find out to fit the arguments to arguments of adapter (see https://github.com/alexhokl/nvim-dap-dotnet/blob/main/lua/dap-dotnet.lua#L115).

{
    type = "coreclr",
    name = "[dap-dotnet] Launch unit test",
    request = "launch",
    -- preLaunchTask = "build",
    program = "test",
    args = {"Some.Tests.dll"},
    cwd = "${workspaceFolder}",
    stopAtEntry = false,
    env = {
        ASPNETCORE_ENVIRONMENT = "Development"
    }
}
DrOptix commented 11 months ago

I the next few days I'll try to take a crack at this. I'll try to apply the same idea as nvim-dap-go by discovering the test I want to debug using treesitter. Debugging unit tests is my main workflow when I work on my projects. I rarely debug the application itself.

It would be really great if I can make it work without having to do the dance of starting the test, make that wait for the debugger to attach and only then continue debugging it. At least I don't want to do that manually.

If I have any success I'll propose a PR.

DrOptix commented 9 months ago

I didn't really have time to work on this trough December. I hope to get cracking this month. Now I need to really study how to make use of treesitter to be able to query about the function we are in and if it is a test or not. It's an area of programming totally new for me so I expect the on boarding to be a bit bumpy, but as I work daily with C# I really want to make this to work.

Of course if you guys have any input about how to better approach this let me know.