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
Significantly reorganize and expand README.md with detailed guidance for running tests locally and in Linux Docker. Add sections on standard vs. Explicit test runs, trait-based filtering, parallelism control, and best practices for test output and CI parity. Reformat Linux Docker instructions for clarity and improve overall usability.
Copy file name to clipboardExpand all lines: Source/Tst/README.md
+71-7Lines changed: 71 additions & 7 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,14 +1,79 @@
1
-
# Tips for running linux unit tests.
1
+
# Tests folder
2
+
3
+
This document covers **local `dotnet test`** workflows (standard vs Explicit) and **Linux Docker** runs.
4
+
5
+
Unless noted otherwise, run commands from the **`Source`** directory (the folder that contains `KZDev.PerfUtils.sln`). The solution uses **artifacts output** (`UseArtifactsOutput`); test build outputs live under **`artifacts/bin/<ProjectName>/release_net*`** at the repository root, not under each project’s `bin` folder.
6
+
7
+
---
8
+
9
+
## Local: standard full suite (Release)
10
+
11
+
Restores, builds, and runs **non-Explicit** tests with the defaults wired in `Directory.Build.props` / `Directory.Build.targets` (`xunit.runner.json`, `KZDev.PerfUtils.tests.runsettings`).
12
+
13
+
**PowerShell or cmd (from `Source`):**
14
+
15
+
```cmd
16
+
dotnet restore KZDev.PerfUtils.sln
17
+
dotnet build KZDev.PerfUtils.sln -c Release
18
+
dotnet test KZDev.PerfUtils.sln -c Release --no-build
19
+
```
20
+
21
+
**bash (from `Source`):**
22
+
23
+
```bash
24
+
dotnet restore KZDev.PerfUtils.sln
25
+
dotnet build KZDev.PerfUtils.sln -c Release
26
+
dotnet test KZDev.PerfUtils.sln -c Release --no-build
27
+
```
28
+
29
+
`[Fact(Explicit = true)]` tests are **skipped** in this default configuration.
30
+
31
+
---
32
+
33
+
## Local: Explicit-only run (serialized xUnit)
34
+
35
+
Explicit stress tests are marked with **`[Trait(TestMode, Explicit)]`** (see `KZDev.PerfUtils.TestBase/TestConstants.cs`: trait name **`TestMode`**, value **`Explicit`**). Prefer **trait-based** selection so shared test sources are not tied to fragile method-name lists.
36
+
37
+
This repository’s `dotnet test` path uses **VSTest** (not Microsoft Testing Platform by default). Use a VSTest **`--filter`** for the trait, and pass **xUnit RunSettings** after `--` so explicit tests **execute** and xUnit runs **single-threaded** with **no assembly/collection parallelism** (same values as `Tst/xunit.runner.explicit.json`).
38
+
39
+
**One-shot command (from `Source`, after a Release build):**
- Do **not** pass xUnit query filters such as `--filter-query /[TestMode=Explicit]` after `--` with this VSTest setup; the leading `/` is treated like a runsettings token and triggers **“invalid token”** errors. Prefer the `--filter` + `xUnit.*` form above.
54
+
-**CI parity (optional):** To match the workflow that copies `Tst/xunit.runner.explicit.json` over each test output `xunit.runner.json`, run a **Release**`dotnet build` first, then copy that file onto every `artifacts/bin/*/release_net*/xunit.runner.json` under the repo root, then run the same `dotnet test` line **including**`--filter "TestMode=Explicit"` and `-- xUnit.Explicit=only` (the copy adjusts parallelism; the filter + `Explicit=only` still selects and runs explicit tests).
55
+
56
+
**Optional stricter host parallelism:** To cap VSTest process parallelism as well, copy `KZDev.PerfUtils.tests.runsettings` to a local file, set `<MaxCpuCount>1</MaxCpuCount>` under `<RunConfiguration>`, and add `dotnet test ... --settings path\to\your.runsettings`. Session timeout and other settings can stay aligned with the checked-in runsettings.
57
+
58
+
---
59
+
60
+
## Trait convention for new Explicit tests
61
+
62
+
Add **`[Trait(TestConstants.TestTrait.TestMode, TestConstants.TestMode.Explicit)]`** (or the string literals **`TestMode`** / **`Explicit`**) alongside **`[Fact(Explicit = true)]`** so Explicit-only runs remain discovery-based across assemblies that share source files.
63
+
64
+
---
65
+
66
+
## Linux: Docker-based test run
2
67
3
68
> Run these commands from the \{RepositoryRoot\}\Source directory
0 commit comments