Skip to content

Commit c397557

Browse files
authored
doc: include information for local testing against the RealFileSystem (#325)
Document the available constants to run tests against the `RealFileSystem` also on the local machine: - [`ENABLE_REALFILESYSTEMTESTS_IN_DEBUG`](https://github.com/Testably/Testably.Abstractions/blob/main/Tests/Helpers/Testably.Abstractions.Tests.SourceGenerator/ClassGenerators/FileSystemClassGenerator.cs#L59) If set, the classes for executing tests against the real file system are created also in DEBUG mode. - [`INCLUDE_LONGRUNNING_TESTS_ALSO_IN_DEBUG_MODE`](https://github.com/Testably/Testably.Abstractions/blob/main/Tests/Helpers/Testably.Abstractions.TestHelpers/Test.cs#L51) In order to increase the test execution speed during development, long running tests are disabled in DEBUG mode. When this constant is set, the corresponding tests are no longer skipped. - [`SKIP_TESTS_ON_REAL_FILESYSTEM`](https://github.com/Testably/Testably.Abstractions/blob/main/Tests/Helpers/Testably.Abstractions.TestHelpers/Test.cs#L61) In order to avoid unnecessary side-effects on development machines, tests against the real file system are not executed in DEBUG mode. When this constant is set, this restriction no longer applies.
1 parent 999be95 commit c397557

File tree

2 files changed

+25
-7
lines changed

2 files changed

+25
-7
lines changed

.gitignore

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,7 @@
11
# Ignore the Directory.Build.props in the root directory so that
22
# the setting of specific constants can improve the developer experience
3-
# without affecting the origin GIT repository:
4-
# - `SKIP_TESTS_ON_REAL_FILESYSTEM`
5-
# By setting this flag, all tests against the real file system are skipped when in DEBUG mode.
6-
# - `INCLUDE_LONGRUNNING_TESTS_ALSO_IN_DEBUG_MODE`
7-
# Per default, long-running tests against the real file system are skipped when in DEBUG mode. By setting this flag, these tests are run also in this mode.
8-
# - `EXECUTE_EXAMPLE_TESTS`
9-
# Tests in the example projects are only executed when this flag is set.
3+
# without affecting the origin GIT repository.
4+
# > https://github.com/Testably/Testably.Abstractions/blob/main/CONTRIBUTING.md#tests
105
/Directory.Build.props
116

127
# Set up Visual Studio to use WSL to execute unit tests in Ubuntu:

CONTRIBUTING.md

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,29 @@ In order to support this, static code analysis is performed using [SonarCloud](h
1313

1414
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/).
1515

16+
## Tests
17+
On the build system, unit tests are executed both against the `MockFileSystem` and the `RealFileSystem`. This ensures that the tests verify correct assumptions.
18+
In order to simplify and speedup the development process, per default some tests are disabled in DEBUG mode. These can be enabled by adding a `Directory.Build.props` file in the root directory and set the corresponding constants:
19+
- [`ENABLE_REALFILESYSTEMTESTS_IN_DEBUG`](https://github.com/Testably/Testably.Abstractions/blob/main/Tests/Helpers/Testably.Abstractions.Tests.SourceGenerator/ClassGenerators/FileSystemClassGenerator.cs#L59)
20+
If set, the classes for executing tests against the real file system are created also in DEBUG mode.
21+
- [`INCLUDE_LONGRUNNING_TESTS_ALSO_IN_DEBUG_MODE`](https://github.com/Testably/Testably.Abstractions/blob/main/Tests/Helpers/Testably.Abstractions.TestHelpers/Test.cs#L51)
22+
In order to increase the test execution speed during development, long running tests are disabled in DEBUG mode.
23+
When this constant is set, the corresponding tests are no longer skipped.
24+
- [`SKIP_TESTS_ON_REAL_FILESYSTEM`](https://github.com/Testably/Testably.Abstractions/blob/main/Tests/Helpers/Testably.Abstractions.TestHelpers/Test.cs#L61)
25+
In order to avoid unnecessary side-effects on development machines, tests against the real file system are not executed in DEBUG mode.
26+
When this constant is set, this restriction no longer applies.
27+
28+
**Example:**
29+
```xml
30+
<Project>
31+
<PropertyGroup>
32+
<DefineConstants>$(DefineConstants);ENABLE_REALFILESYSTEMTESTS_IN_DEBUG</DefineConstants>
33+
</PropertyGroup>
34+
</Project>
35+
```
36+
37+
*Note: This file is excluded in [`.gitignore`](https://github.com/Testably/Testably.Abstractions/blob/main/.gitignore) and remains local!*
38+
1639
## Versioning
1740
This project uses [MinVer](https://github.com/adamralph/minver) for versioning.
1841
Tags are automatically added during a release build. In order to trigger a release, create a release branch. After all tests are successful and the manual check is approved, that Tag is automatically applied and Nuget Packages are pushed to [nuget.org](https://www.nuget.org/packages/Testably.Abstractions).

0 commit comments

Comments
 (0)