
Description
Description
IMPORTANT: if the defect is reproduced only in a workflow from within the Visual Studio IDE then do not report the issue here - instead, please report it using Visual Studio's "Send Feedback" option that can be accessed from the Help menu OR using this link https://developercommunity.visualstudio.com.
For a defect reproducable from the vstest command line, describe the issue you've observed.
First reported by a customer in 2013 before it was part of dotnetsdk, the --filter
option doesn't permit empty string when setting TestCategory filter. This prevents uses from selecting just those test where TestCategory was not specified. As there's no way to require TestCategory to be set, this effectively prevents users from running just the "default" test of unit tests with a simple self contained TestCategory query.
Steps to reproduce
$ dotnet new test
The template "MSTest Test Project (.NET Core)" was created successfully.$ dotnet test --filter "TestCategory="
Determining projects to restore...
All projects are up-to-date for restore.
You are using a preview version of .NET. See: https://aka.ms/dotnet-core-preview
test -> C:\scratch\test\bin\Debug\net5.0\test.dll
Test run for C:\scratch\test\bin\Debug\net5.0\test.dll (.NETCoreApp,Version=v5.0)
Microsoft (R) Test Execution Command Line Tool Version 16.9.0-preview-20210125-03
Copyright (c) Microsoft Corporation. All rights reserved.Starting test execution, please wait...
A total of 1 test files matched the specified pattern.
Incorrect format for TestCaseFilter Error: Invalid Condition 'TestCategory='. Specify the correct format and try again. Note that > the incorrect format can lead to no test getting executed.
No test matches the given testcase filterTestCategory=
in C:\scratch\test\bin\Debug\net5.0\test.dll
[Expected]
.
[Actual]
Expected behavior
Run the one test, and passes
Actual behavior
Fails, see above log
Diagnostic logs
N/A
Environment
$ ver
Microsoft Windows [Version 10.0.19042.867]
$ dotnet --list-sdks
2.1.514 [C:\Program Files\dotnet\sdk]
2.1.518 [C:\Program Files\dotnet\sdk]
2.1.522 [C:\Program Files\dotnet\sdk]
2.1.814 [C:\Program Files\dotnet\sdk]
3.1.302 [C:\Program Files\dotnet\sdk]
3.1.407 [C:\Program Files\dotnet\sdk]
5.0.103 [C:\Program Files\dotnet\sdk]
5.0.104 [C:\Program Files\dotnet\sdk]
5.0.200-preview.21077.7 [C:\Program Files\dotnet\sdk]
5.0.200 [C:\Program Files\dotnet\sdk]
5.0.201 [C:\Program Files\dotnet\sdk]
6.0.100-preview.1.21103.13 [C:\Program Files\dotnet\sdk]