You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Update library testing docs page to reduce confusion (#54324)
* Add warning on unmaintained testing doc page
* Update testing.md
Some example text that seems more clear to me, but only offered as a suggestion.
Feel free to adjust it or if you want to use it as-is please double check what I wrote is accurate : )
I think the useful elements are:
1. Being explicit about what workflow steps need to happen in total
2. Being explicit about which commands are covering the entire workflow and which ones are only covering a part of it
3. Show the simple "do-it-all" options first before showing more complex partial options. Glancing at the first example and blindly copying it should land in the pit of success.
Co-authored-by: Viktor Hofer <[email protected]>
Copy file name to clipboardexpand all lines: docs/workflow/testing/libraries/testing.md
+41-24
Original file line number
Diff line number
Diff line change
@@ -1,54 +1,71 @@
1
1
# Testing Libraries
2
2
3
-
We use the OSS testing framework [xunit](https://github.com/xunit/xunit).
3
+
## Full Build and Test Run
4
4
5
-
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.
5
+
These example commands automate the test run and all pre-requisite build steps in a single command from a clean enlistment.
6
6
7
-
**Examples**
8
-
- The following shows how to build only the tests but not run them:
7
+
- Run all tests - Builds clr in release, libs+tests in debug:
- The following builds mono and libs for x86 architecture and runs all tests:
42
+
Building the `libs` subset or any of individual library projects automatically copies product binaries into the testhost folder
43
+
in the bin directory. This is where the tests will load the binaries from during the run. However System.Private.CorLib is an
44
+
exception - the build does not automatically copy it to the testhost folder. If you [rebuild System.Private.CoreLib](https://github.com/dotnet/runtime/blob/main/docs/workflow/building/libraries/README.md#iterating-on-systemprivatecorelib-changes) you must also build the `libs.pretest` subset to ensure S.P.C is copied before running tests.
45
+
46
+
### Running tests for all libraries
47
+
48
+
- Build and run all tests in release configuration.
34
49
```
35
-
build.cmd/sh -subset mono+libs+libs.tests -test -arch x86
50
+
build.cmd/sh -subset libs.tests -test -c Release
36
51
```
37
52
38
-
-The following example shows how to pass extra msbuild properties to ignore tests ignored in CI:
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.
70
87
71
-
####Running a single test on the command line
88
+
### Running a single test on the command line
72
89
73
90
To quickly run or debug a single test from the command line, set the XunitMethodName property, e.g.:
To run all tests, including "outer loop" tests (which are typically slower and in some test suites less reliable, but which are more comprehensive):
81
98
```cmd
82
99
dotnet build /t:Test /p:Outerloop=true
83
100
```
84
101
85
-
####Running tests on a different target framework
102
+
### Running tests on a different target framework
86
103
87
104
Each test project can potentially have multiple target frameworks. 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 target frameworks. By default we will build and run only the default build target framework which is `net5.0`. The rest of the `TargetFrameworks` will need to be built and ran by specifying the `BuildTargetFramework` option, e.g.:
0 commit comments