diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 3e9af8f43..54203c3a0 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -23,18 +23,22 @@ In order to support this, static code analysis is performed using [SonarCloud](h - solve all issues reported by SonarCloud - have a code coverage of > 90% -Additionally each push to the `main` branch checks the quality of the unit tests using [Stryker.NET](https://stryker-mutator.io/docs/stryker-net/introduction/). +Additionally the quality of the unit tests can be checked with [Stryker.NET](https://stryker-mutator.io/docs/stryker-net/introduction/) mutation tests (`./build.ps1 MutationTestsWindows` and `./build.sh MutationTestsLinux`). The mutation jobs in the CI workflow are currently disabled. ## Tests On the build system, unit tests are executed both against the `MockFileSystem` and the `RealFileSystem`. This ensures that the tests verify correct assumptions. In order to simplify and speedup the development process, per default, some tests are disabled in DEBUG mode. -These can be enabled by explicitely running the [`Testably.Abstractions.TestSettings`](https://github.com/Testably/Testably.Abstractions/tree/main/Tests/Settings/Testably.Abstractions.TestSettings) tests: +These can be enabled by changing the defaults in [`Settings.cs`](https://github.com/Testably/Testably.Abstractions/blob/main/Tests/Helpers/Testably.Abstractions.TestHelpers/Settings.cs) locally: - `LongRunningTests` (`AlwaysEnabled` / `DisabledInDebugMode` (default) / `AlwaysDisabled`) Some tests take a long time to run against the real file system (e.g. timeout). Per default, they are disabled in DEBUG mode. - `RealFileSystemTests` (`AlwaysEnabled` / `DisabledInDebugMode` (default) / `AlwaysDisabled`) All tests against the real file system. Per default, they are disabled in DEBUG mode. +- `BrittleTests` (`AlwaysEnabled` / `DisabledInDebugMode` / `AlwaysDisabled` (default)) + Timing-sensitive tests against the real time system. Per default, they are always disabled. -*Note: These settings are stored locally in `test.settings.json` which is excluded in [`.gitignore`](https://github.com/Testably/Testably.Abstractions/blob/main/.gitignore) so that it only affects the individual developer!* +*Note: Do not commit changes to these defaults, so that they only affect the individual developer!* + +The test projects are [TUnit](https://tunit.dev/) executables on Microsoft.Testing.Platform. Run them with `dotnet test --project `, e.g. `dotnet test --project Tests/Testably.Abstractions.Tests -f net10.0 --treenode-filter "/*/*/ExistsTests/*"`. ## Documentation To get a better understanding of the different mock implementations, see [Maintainer.md](./Docs/Maintainer.md). diff --git a/Docs/agents/workflows.md b/Docs/agents/workflows.md index a7011fc24..9886303dd 100644 --- a/Docs/agents/workflows.md +++ b/Docs/agents/workflows.md @@ -70,7 +70,7 @@ dotnet test --project Tests/Api/Testably.Abstractions.Api.Tests --no-build --tre | `CodeAnalysis` | SonarCloud begin/end around `Compile` and `CodeCoverage`; needs `SonarToken` | | `Pack` | Collect the packages into `Artifacts/Packages/Core` and `Artifacts/Packages/Main` | | `MutationTestsWindows`, `MutationTestsLinux`, `MutationTests` | Stryker.NET mutation tests (see below) | -| `MutationComment` | Post or update the mutation summary on the pull request | +| `MutationTestsDashboard`, `MutationTestsComment` | Upload the mutation reports to the Stryker dashboard and post or update the mutation summary on the pull request (`ci-analysis.yml`, currently disabled) | `BuildScope` (`Pipeline/BuildScope.cs`, set in `Pipeline/Build.cs`) is `Default`, `CoreOnly` or `MainOnly`. It limits `Compile`, `Pack` and `ApiChecks` to the Core or main projects and disables unit tests, coverage, Sonar and mutation tests where they do not apply. Use `CoreOnly` while a Core change waits for its release, because the main projects still build against the released `Testably.Abstractions.Interface` package. @@ -83,7 +83,7 @@ dotnet test --project Tests/Api/Testably.Abstractions.Api.Tests --no-build --tre ./build.ps1 MutationTestsLinux ``` -The targets install `dotnet-stryker` into `TestResults/dotnet-stryker` and mutate on `net10.0`; reports go to `Artifacts/Stryker`. `MutationTestsWindows` covers `Testably.Abstractions`, `.AccessControl`, `.Compression` and `.MemoryMappedFiles`; `MutationTestsLinux` covers `Testably.Abstractions.Testing`, with exclusions for OS-specific helpers and exception messages listed in `Pipeline/Build.MutationTests.cs`. Off `main` only changed code is mutated (`since: main`). A full run takes a long time; only run it when asked. The mutation jobs in `ci.yml` are currently disabled (`if: false`). +The targets install `dotnet-stryker` (version pinned by the `PackageDownload` in `Pipeline/Build.csproj`) into `TestResults/dotnet-stryker` and mutate on `net10.0` with `--test-runner mtp`, because the TUnit test projects run on Microsoft.Testing.Platform; reports go to `Artifacts/Stryker`. `MutationTestsWindows` covers `Testably.Abstractions`, `.AccessControl`, `.Compression` and `.MemoryMappedFiles`; `MutationTestsLinux` covers `Testably.Abstractions.Testing`, with exclusions for OS-specific helpers and exception messages listed in `Pipeline/Build.MutationTests.cs`. Off `main` only changed code is mutated (`since: main`). A full run takes a long time; only run it when asked. The mutation jobs in `ci.yml` are currently disabled (`if: false`). ## Documentation @@ -100,4 +100,4 @@ The targets install `dotnet-stryker` into `TestResults/dotnet-stryker` and mutat | `build.yml` | Push to `main`, `v*` and `core/v*` tags | The same checks plus `Pack`; a `core/v*` tag pushes `Artifacts/Packages/Core`, a `v*` tag pushes `Artifacts/Packages/Main` to nuget.org via trusted publishing and creates a GitHub release for non-prerelease tags | | `notify-docs-site.yml` | Push to `main` touching `Docs/pages/docs/**` | Dispatches a rebuild of the docs site | -Renovate keeps dependencies current; `.github/mergify.yml` squash-merges its PRs once the unit and API test checks pass. All checkouts use `fetch-depth: 0` because GitVersion needs the full history. +Dependabot (`.github/dependabot.yml`) keeps dependencies current; `.github/mergify.yml` squash-merges its PRs once the unit and API test checks pass. All checkouts use `fetch-depth: 0` because GitVersion needs the full history. diff --git a/Pipeline/Build.csproj b/Pipeline/Build.csproj index 38fd27482..a70b8928f 100644 --- a/Pipeline/Build.csproj +++ b/Pipeline/Build.csproj @@ -33,7 +33,6 @@ - diff --git a/Tests/Directory.Build.props b/Tests/Directory.Build.props index 6c1ce3cef..ba1ff0ea3 100644 --- a/Tests/Directory.Build.props +++ b/Tests/Directory.Build.props @@ -16,7 +16,7 @@ enable false Exe - $(NoWarn);701;1702;CA1845;MA0003;MA0004;MA0018;MA0020;MA0038;MA0042;MA0076;xUnit1045;NU1603 + $(NoWarn);701;1702;CA1845;MA0003;MA0004;MA0018;MA0020;MA0038;MA0042;MA0076;NU1603 false