From 7ad0e6ff1d723eb82b9c6a239472a3bbb729e733 Mon Sep 17 00:00:00 2001 From: XperiAndri Date: Mon, 5 Oct 2026 02:13:28 +0200 Subject: [PATCH] test: categorize the tests per tested component As in FSharp.Azure.Cosmos, every test class carries a self-sufficient `TestCategoryBaseAttribute` from `TestCategories.fs`, so a subset runs with `--filter TestCategory=...` without a separate string constant: `ProcessingOptions`, `Observable`, `Chunk`, `Builder`, `Async`, `Task`, `MapAsync` (also `Async` and `Task`, because every mapAsync test runs both flavours) and `Integration`. The two existing test classes get their categories now; the test classes of the integration suite get theirs as they are added. Co-Authored-By: Claude Opus 5.5 --- .github/copilot-instructions.md | 1 + tests/FSharp.Control.R3.Tests/BuilderTests.fs | 2 +- .../FSharp.Control.R3.Tests.fsproj | 1 + .../ObservableTests.fs | 2 +- .../FSharp.Control.R3.Tests/TestCategories.fs | 65 +++++++++++++++++++ 5 files changed, 69 insertions(+), 2 deletions(-) create mode 100644 tests/FSharp.Control.R3.Tests/TestCategories.fs diff --git a/.github/copilot-instructions.md b/.github/copilot-instructions.md index 8ae931e..dbc7e09 100644 --- a/.github/copilot-instructions.md +++ b/.github/copilot-instructions.md @@ -22,6 +22,7 @@ │ ├── AsyncObservable.fs – Async flavour (cold `Async` terminals, `mapAsync`, `ofAsync`) │ └── TaskObservable.fs – Task flavour (hot `Task` terminals, `mapAsync`, `ofTask`) ├── tests/FSharp.Control.R3.Tests/ – MSTest test project +│ ├── TestCategories.fs – test category attributes for `--filter TestCategory=...` │ ├── BuilderTests.fs – builder behavior tests │ └── ObservableTests.fs – observable behavior tests ├── build/ – FAKE build scripts and release automation diff --git a/tests/FSharp.Control.R3.Tests/BuilderTests.fs b/tests/FSharp.Control.R3.Tests/BuilderTests.fs index 14e9645..53ec263 100644 --- a/tests/FSharp.Control.R3.Tests/BuilderTests.fs +++ b/tests/FSharp.Control.R3.Tests/BuilderTests.fs @@ -7,7 +7,7 @@ open FSharp.Control.R3.Observable.Builders open Microsoft.VisualStudio.TestTools.UnitTesting open Swensen.Unquote -[] +[] type BuilderTests () = [] diff --git a/tests/FSharp.Control.R3.Tests/FSharp.Control.R3.Tests.fsproj b/tests/FSharp.Control.R3.Tests/FSharp.Control.R3.Tests.fsproj index b8b5d66..c087917 100644 --- a/tests/FSharp.Control.R3.Tests/FSharp.Control.R3.Tests.fsproj +++ b/tests/FSharp.Control.R3.Tests/FSharp.Control.R3.Tests.fsproj @@ -12,6 +12,7 @@ + diff --git a/tests/FSharp.Control.R3.Tests/ObservableTests.fs b/tests/FSharp.Control.R3.Tests/ObservableTests.fs index 2aa043a..2a6a2b6 100644 --- a/tests/FSharp.Control.R3.Tests/ObservableTests.fs +++ b/tests/FSharp.Control.R3.Tests/ObservableTests.fs @@ -6,7 +6,7 @@ open FSharp.Control.R3.Async open Microsoft.VisualStudio.TestTools.UnitTesting open Swensen.Unquote -[] +[] type ObservableTests () = [] diff --git a/tests/FSharp.Control.R3.Tests/TestCategories.fs b/tests/FSharp.Control.R3.Tests/TestCategories.fs new file mode 100644 index 0000000..c6952c9 --- /dev/null +++ b/tests/FSharp.Control.R3.Tests/TestCategories.fs @@ -0,0 +1,65 @@ +// Every TestCategoryBaseAttribute descendant used to categorize the tests of this project, one per tested component. +// MSTest picks up their TestCategories through --filter TestCategory=... exactly like []'s, +// but each attribute is self-sufficient: no separate string constant is needed to know what to pass it. +namespace FSharp.Control.R3.Tests + +open System.Collections.Generic +open Microsoft.VisualStudio.TestTools.UnitTesting + +/// +/// Categorizes the tests of and +/// . +/// +type ProcessingOptionsTestCategoryAttribute () = + inherit TestCategoryBaseAttribute () + override _.TestCategories = [| "ProcessingOptions" |] :> IList + +/// +/// Categorizes the tests of the functions of the module, +/// of and of the factories. +/// +type ObservableTestCategoryAttribute () = + inherit TestCategoryBaseAttribute () + override _.TestCategories = [| "Observable" |] :> IList + +/// +/// Categorizes the tests of the chunking functions and of . +/// +type ChunkTestCategoryAttribute () = + inherit TestCategoryBaseAttribute () + override _.TestCategories = [| "Chunk" |] :> IList + +/// +/// Categorizes the tests of the query builder. +/// +type BuilderTestCategoryAttribute () = + inherit TestCategoryBaseAttribute () + override _.TestCategories = [| "Builder" |] :> IList + +/// +/// Categorizes the tests of the Async flavour, . +/// +type AsyncTestCategoryAttribute () = + inherit TestCategoryBaseAttribute () + override _.TestCategories = [| "Async" |] :> IList + +/// +/// Categorizes the tests of the Task flavour, . +/// +type TaskTestCategoryAttribute () = + inherit TestCategoryBaseAttribute () + override _.TestCategories = [| "Task" |] :> IList + +/// +/// Categorizes the tests of mapAsync, which run every test against both flavours, so they also belong to the Async and Task categories. +/// +type MapAsyncTestCategoryAttribute () = + inherit TestCategoryBaseAttribute () + override _.TestCategories = [| "MapAsync"; "Async"; "Task" |] :> IList + +/// +/// Categorizes the end-to-end scenarios that combine several areas of the library. +/// +type IntegrationTestCategoryAttribute () = + inherit TestCategoryBaseAttribute () + override _.TestCategories = [| "Integration" |] :> IList