From 12f1f58ec06be6d1ca8ab42d4249e8b0fa9ab4f9 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Marie=20P=C3=ADchov=C3=A1?= Date: Fri, 21 Feb 2020 22:18:37 +0100 Subject: [PATCH] Removed misleading doc and added -vs testing (#32618) Co-authored-by: Viktor Hofer --- docs/workflow/testing/libraries/testing-vs.md | 22 ---------------------- docs/workflow/testing/libraries/testing.md | 10 ++++++++++ 2 files changed, 10 insertions(+), 22 deletions(-) delete mode 100644 docs/workflow/testing/libraries/testing-vs.md diff --git a/docs/workflow/testing/libraries/testing-vs.md b/docs/workflow/testing/libraries/testing-vs.md deleted file mode 100644 index cfd3b21..0000000 --- a/docs/workflow/testing/libraries/testing-vs.md +++ /dev/null @@ -1,22 +0,0 @@ -# Running unit tests within Visual Studio - -Sometimes it is convenient to run individual unit tests within the Visual Studio -IDE. First, build the repo from the command line to create artifacts and set up -the test environment. Then, use VS Test Explorer to run and debug tests. - -## Steps - -1. `build.cmd -test` -2. Open the solution file in the root of the repo. -3. Open the test explorer window within the Visual Studio IDE. -4. Select tests and run and/or debug. - -## Limitations - -* The managed projects load and build, but native and setup projects are not - present in the solution and there's no way to trigger a build from inside VS. -* Rebuilding the native assets alone won't make them used during tests. The - tests rely on the setup projects to assemble the native bits into a usable - form, and they have to be rebuilt. - * With a deep enough understanding of the test layout, you can work around - this by copying native build outputs directly into the test layout. diff --git a/docs/workflow/testing/libraries/testing.md b/docs/workflow/testing/libraries/testing.md index a332c9f..9baaa5f 100644 --- a/docs/workflow/testing/libraries/testing.md +++ b/docs/workflow/testing/libraries/testing.md @@ -53,3 +53,13 @@ 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. -- 2.7.4