From 0896dd8204d0942f15be1ea6f42b71aa3a363b01 Mon Sep 17 00:00:00 2001 From: Viktor Hofer Date: Thu, 20 Feb 2020 17:39:21 +0100 Subject: [PATCH] Update testing with configuration system changes --- docs/workflow/testing/libraries/testing.md | 18 ++++++++---------- 1 file changed, 8 insertions(+), 10 deletions(-) diff --git a/docs/workflow/testing/libraries/testing.md b/docs/workflow/testing/libraries/testing.md index 82d6b7c..1be5604 100644 --- a/docs/workflow/testing/libraries/testing.md +++ b/docs/workflow/testing/libraries/testing.md @@ -10,9 +10,9 @@ To build the tests and run them you can call the libraries build script. libraries -buildtests ``` -- The following builds and runs all tests for netcoreapp in release configuration. +- The following builds and runs all tests for .NET Core in release configuration. ``` -libraries -buildtests -test -c Release -f netcoreapp +libraries -buildtests -test -c Release ``` - The following example shows how to pass extra msbuild properties to ignore tests ignored in CI. @@ -30,13 +30,12 @@ The easiest (and recommended) way to do it, is by simply building the test .cspr ```cmd cd src\libraries\System.Collections.Immutable\tests -dotnet msbuild /t:BuildAndTest ::or /t:Test to just run the tests if the binaries are already built -dotnet msbuild /t:RebuildAndTest ::this will cause a test project to rebuild and then run tests +dotnet build /t:BuildAndTest ::or /t:Test to just run the tests if the binaries are already built ``` It is possible to pass parameters to the underlying xunit runner via the `XUnitOptions` parameter, e.g.: ```cmd -dotnet msbuild /t:Test "/p:XUnitOptions=-class Test.ClassUnderTests" +dotnet build /t:Test "/p:XUnitOptions=-class Test.ClassUnderTests" ``` There may be multiple projects in some directories so you may need to specify the path to a specific test project to get it to build and run the tests. @@ -45,14 +44,13 @@ There may be multiple projects in some directories so you may need to specify th To quickly run or debug a single test from the command line, set the XunitMethodName property, e.g.: ```cmd -dotnet msbuild /t:RebuildAndTest /p:XunitMethodName={FullyQualifiedNamespace}.{ClassName}.{MethodName} +dotnet build /t:BuildAndTest /p:XunitMethodName={FullyQualifiedNamespace}.{ClassName}.{MethodName} ``` #### Running tests in a different target framework -Each test project can potentially have multiple build configurations. There are some tests that might be OS-specific, or might be testing an API that is available only on some target frameworks, so the `BuildConfigurations` property specifies the valid configurations. By default we will build and run only the default build configuration which is `netcoreapp`. The rest of the configurations will need to be built and ran by specifying the configuration options. +Each test project can potentially have multiple build configurations. There are some tests that might be OS-specific, or might be testing an API that is available only on some target frameworks, so the `TargetFrameworks` property specifies the valid configurations. By default we will build and run only the default build configuration which is `netcoreapp`. The rest of the configurations will need to be built and ran by specifying the `BuildTargetFramework` option. ```cmd -cd src\libraries\System.Runtime\tests -dotnet msbuild System.Runtime.Tests.csproj /p:TargetGroup=net472 -``` \ No newline at end of file +dotnet build src\libraries\System.Runtime\tests\System.Runtime.Tests.csproj /p:BuildTargetFramework=net472 +``` -- 2.7.4