Dotnet Test Filters

I had the idea that when tests had a Task attribute, one could specify a filter on the command line to run a subset of tasks, but that doesn’t seem to be the case.

To be specific, given a test like this:

[<Fact>]
[<Task(1)>]
let ``New list``() =
    let expected: string list = []
    newList |> should equal expected

The command

dotnet test --filter "Task = 1"

should only run tests that have that attribute. The documentation seems to support this, but it isn’t working for me:

Starting test execution, please wait...
A total of 1 test files matched the specified pattern.
No test matches the given testcase filter `Task = 1` in C:\Users\bozo\Exercism\fsharp\tracks-on-tracks-on-tracks\bin\Debug\net7.0\TracksOnTracksOnTracks.dll

The issue isn’t limited to the Tracks On Tracks On Tracks exercise, and isn’t related to tests that are marked to be skipped.

Am I doing something wrong?

Could you link me to the documentation?

By golly, that’s what happens when you think you know something.

Here’s the documentation: Run selected unit tests - .NET | Microsoft Learn. I didn’t notice that it only works for specific attributes, which don’t include Task, so the answer to my question is, “Yes, you are doing something wrong.”

It’s unfortunate that this isn’t easier, sorry.

Oh, it’s entirely on me. I’m letting the forum make me lazy; asking questions instead of doing proper research.