Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 26 additions & 1 deletion docs/workflow/testing/libraries/testing.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,19 +2,39 @@

We use the OSS testing framework [xunit](http://xunit.github.io/).

To build the tests and run them you can call the libraries build script.
To build the tests and run them you can call the libraries build script. For libraries tests to work, you must have built the coreclr or mono runtime for them to run on.

**Examples**
- The following shows how to build only the tests but not run them:
```
build.cmd/sh -subset libs.tests
```

- The following builds and runs all tests using clr:
```
build.cmd/sh -subset clr+libs.tests -test
```

- The following builds and runs all tests using mono:
```
build.cmd/sh -subset mono+libs.tests -test
```

- The following builds and runs all tests in release configuration:
```
build.cmd/sh -subset libs.tests -test -c Release
```

- The following builds clr in release, libs in debug and runs all tests:
```
build.cmd/sh -subset clr+libs+libs.tests -test -rc Release
```

- The following builds mono and libs for x86 architecture and runs all tests:
```
build.cmd/sh -subset mono+libs+libs.tests -test -arch x86
```

- The following example shows how to pass extra msbuild properties to ignore tests ignored in CI:
```
build.cmd/sh -subset libs.tests -test /p:WithoutCategories=IgnoreForCI
Expand All @@ -41,6 +61,11 @@ It is possible to pass parameters to the underlying xunit runner via the `XUnitO
dotnet build /t:Test /p:XUnitOptions="-class Test.ClassUnderTests"
```

Which is very useful when you want to run tests as `x86` on a `x64` machine:
```cmd
dotnet build /t:Test /p:TargetArchitecture=x86
```

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.

#### Running a single test on the command line
Expand Down