OmniSharp / omnisharp-vim

Vim omnicompletion (intellisense) and more for C#
http://www.omnisharp.net
MIT License
1.7k stars 169 forks source link

Run entire test projects #763

Closed rayanbakhtiari closed 2 years ago

rayanbakhtiari commented 2 years ago

Hi, if I want to run all tests in a file I should use OmniSharpRunTestsInFile. if I pass a file address or multiple file addresses it will run all the test files I passed. but passing file addresses one by one manually is not convenient. but it could be great if we can pass a regex as a parameter, so I can pass something like this */Tests.cs so it can run all tests files. of if there is an alternative to achieve this. could you please help me with this? in vscode there is a Testing section that shows all tests in a project that you can run them all. the same feature is in Visual Studio. but I don't know how to do that in vim-omnisharp.

nickspoons commented 2 years ago

I'm not at the computer right now to test but you can pass an array of filenames to OmniSharp#actions#test#RunInFile(), so you can do something like this:

:call OmniSharp#actions#test#RunInFile(0, split(globpath('**', '*Tests.cs'), ','))
rayanbakhtiari commented 2 years ago

I'm not at the computer right now to test but you can pass an array of filenames to OmniSharp#actions#test#RunInFile(), so you can do something like this:

:call OmniSharp#actions#test#RunInFile(0, split(globpath('**', '*Tests.cs'), ','))

Thanks @nickspoons . it's working for me . I just changed split(globpath('**', '*Tests.cs'), ',') to split(globpath('**', '*Tests.cs'), '\n')

nickspoons commented 2 years ago

Ok, good to hear that works for you