vstest icon indicating copy to clipboard operation
vstest copied to clipboard

Print command line and environment to manually run tests without overhead

Open krwq opened this issue 2 years ago • 2 comments

Description

On some occasions when debugging i.e. intermittent issues or other things it's really useful to run tests faster without extra overhead of build related stuff. It would be good if we printed exact command line and environment needed to do so (i.e. only with -v or always, doesn't matter). That would save several minutes for me each time I need to do it.

Steps to reproduce

dotnet test -v [csproj]

Expected behavior

Build output showing something similar to:

===
Running tests:
CWD: working directory here
<environment variables setup here>
<path to runner.exe> <some args here>
===

ideally something I can copy & paste in current shell to get equivalent of what runner is doing without extra overhead.

Actual behavior

Need to figure that out myself.

krwq avatar Aug 31 '23 08:08 krwq

dotnet test is simply forwarding the call to vstest.console.exe with translation of parameters. Have you tried to look at https://learn.microsoft.com/visualstudio/test/vstest-console-options?view=vs-2022 to see if you could find all arguments you need?

Evangelink avatar Aug 31 '23 12:08 Evangelink

dotnet test --no-build is the best you can get to right now. There are 2 modes under dotnet test. 1 is running via csproj, there we need msbuild to figure out where your dll will be. The other one is passing the dll directly, there is no msbuild overhead (e.g. dotnet test your.dll), and that is the fastest way to run vstest currectly.

nohwnd avatar Oct 11 '23 10:10 nohwnd