Skip to content
Merged
Show file tree
Hide file tree
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
10 changes: 7 additions & 3 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -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 <path>`, 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).
Expand Down
6 changes: 3 additions & 3 deletions Docs/agents/workflows.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.

Expand All @@ -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

Expand All @@ -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.
1 change: 0 additions & 1 deletion Pipeline/Build.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,6 @@
<PackageDownload Include="dotnet-stryker" Version="[5.0.0]" />
<PackageDownload Include="GitVersion.Tool" Version="[6.0.5]" />
<PackageDownload Include="ReportGenerator" Version="[5.4.1]" />
<PackageDownload Include="xunit.runner.console" Version="[2.9.2]" />
</ItemGroup>

</Project>
2 changes: 1 addition & 1 deletion Tests/Directory.Build.props
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
<Nullable>enable</Nullable>
<IsPackable>false</IsPackable>
<OutputType>Exe</OutputType>
<NoWarn>$(NoWarn);701;1702;CA1845;MA0003;MA0004;MA0018;MA0020;MA0038;MA0042;MA0076;xUnit1045;NU1603</NoWarn>
<NoWarn>$(NoWarn);701;1702;CA1845;MA0003;MA0004;MA0018;MA0020;MA0038;MA0042;MA0076;NU1603</NoWarn>
<EnableTUnitPolyfills>false</EnableTUnitPolyfills>
</PropertyGroup>

Expand Down
Loading