1
0
Fork 0
mirror of https://github.com/VSadov/Satori.git synced 2025-06-10 10:00:57 +09:00

Update testing with configuration system changes

This commit is contained in:
Viktor Hofer 2020-02-20 17:39:21 +01:00 committed by GitHub
parent e9853d4baa
commit 0896dd8204
Signed by: github
GPG key ID: 4AEE18F83AFDEB23

View file

@ -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
```
dotnet build src\libraries\System.Runtime\tests\System.Runtime.Tests.csproj /p:BuildTargetFramework=net472
```