From 2cd041bbee2170dfa388d37336d50554ea89eb2e Mon Sep 17 00:00:00 2001 From: Viktor Hofer Date: Fri, 8 May 2020 21:03:17 +0200 Subject: [PATCH] Document F5 and Test Explorer prerequisites (#36117) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * Document F5 and Test Explorer prerequisites * Update docs/workflow/testing/visualstudio.md Co-authored-by: Alexander Köplinger --- docs/workflow/testing/libraries/testing.md | 10 ---------- docs/workflow/testing/visualstudio.md | 16 ++++++++++++++++ 2 files changed, 16 insertions(+), 10 deletions(-) create mode 100644 docs/workflow/testing/visualstudio.md diff --git a/docs/workflow/testing/libraries/testing.md b/docs/workflow/testing/libraries/testing.md index bf100c4ba48..986d0e9606e 100644 --- a/docs/workflow/testing/libraries/testing.md +++ b/docs/workflow/testing/libraries/testing.md @@ -63,13 +63,3 @@ Each test project can potentially have multiple target frameworks. There are som ```cmd dotnet build src\libraries\System.Runtime\tests\System.Runtime.Tests.csproj /p:BuildTargetFramework=net472 ``` - -## Running tests from Visual Studio - -**Test Explorer** will be able to discover the tests only if the solution is opened with `build -vs` command, e.g.: -```cmd -build -vs System.Net.Http -``` -If running the tests from **Test Explorer** does nothing, it probably tries to use x86 dotnet installation instead of the x64 one. It can be fixed by setting the x64 architecture manually in the test settings. - -It is also possible to execute the tests by simply debugging the test project once it's been built. It will underneath call the same command as `dotnet build /t:Test` does. diff --git a/docs/workflow/testing/visualstudio.md b/docs/workflow/testing/visualstudio.md new file mode 100644 index 00000000000..c8c20b9cfc7 --- /dev/null +++ b/docs/workflow/testing/visualstudio.md @@ -0,0 +1,16 @@ +# Visual Studio Test Explorer support +For Visual Studio Test Explorer to work in dotnet/runtime, the following test settings need to be enabled: +- Test parameters (like which `dotnet` host to use) are persisted in an auto-generated .runsettings file. For that to work, make sure that the "Auto detect runsettings Files" (`Options -> Test`) option is enabled. +- Make sure that the "Processor Architecture for AnyCPU project" (`Test Explore pane -> Test Explorer toolbar options --> Settings`) value is set to `auto`. + +# Visual Studio F5 Debugging support +dotnet/runtime uses `dotnet test` ([VSTest](https://github.com/Microsoft/vstest)) which spawns child processes during test execution. +Visual Studio by default doesn't automatically debug child processes, therefore preliminary steps need to be done to enable Debugging "F5" support. +Note that these steps aren't necessary for Visual Studio Test Explorer support. +1. Install the [Microsoft Child Process Debugging Power Tool](https://marketplace.visualstudio.com/items?itemName=vsdbgplat.MicrosoftChildProcessDebuggingPowerTool) extension. +2. Go to the child process debug settings (`Debug -> Other Debug Targets -> Child Process Debugging Settings...`), enable the "Enable child process debugging" option and hit save. +3. Go to the project debug settings (`Debug -> $ProjectName Properties`) and enable the "Enable native code debugging" option. + +## References +- https://github.com/dotnet/project-system/issues/6176 tracks enabling the native code debugging functionality for multiple projects without user interaction. +- https://github.com/dotnet/sdk/issues/7419#issuecomment-298261617 explains the necessary steps to install and enable the mentioned extension in more detail.