dotnet test should escape MSBuild special characters in filter
See original GitHub issueInspired by @yshpakov’s dotnet/docs#13749.
dotnet test
accepts a --filter
option that is passed as a property on the MSBuild command line:
Unfortunately, there are some test case names that use MSBuild special characters, like ,
(%2C
). These should be escaped by the test command rather than passing the need to escape up to the user.
Repro steps and workaround:
$ dotnet new mstest
...
$ dotnet test --filter "FullyQualifiedName=MyNamespace.MyTestsClass<ParameterType1,ParameterType2>.MyTestMethod"
MSBUILD : error MSB1006: Property is not valid.
Switch: ParameterType2>.MyTestMethod
For switch syntax, type "MSBuild -help"
$ dotnet test --filter "FullyQualifiedName=MyNamespace.MyTestsClass<ParameterType1%2CParameterType2>.MyTestMethod"
Test run for S:\repro\dotnet\docs\issues\13749\bin\Debug\netcoreapp3.0\13749.dll(.NETCoreApp,Version=v3.0)
Microsoft (R) Test Execution Command Line Tool Version 16.3.0-preview-20190808-04
Copyright (c) Microsoft Corporation. All rights reserved.
Starting test execution, please wait...
A total of 1 test files matched the specified pattern.
No test matches the given testcase filter `FullyQualifiedName=MyNamespace.MyTestsClass<ParameterType1,ParameterType2>.MyTestMethod` in S:\repro\dotnet\docs\issues\13749\bin\Debug\netcoreapp3.0\13749.dll
Issue Analytics
- State:
- Created 4 years ago
- Comments:8 (5 by maintainers)
Top Results From Across the Web
Run selected unit tests - .NET
With the dotnet test command in .NET Core, you can use a filter expression to run selected tests. This article demonstrates how to...
Read more >How to escape quotes in dotnet test --filter
I'd like to run tests from commandline using dotnet test --filter , I have tests with fully qualified name similar to: Namespace.
Read more >Coverage Analysis from the Command Line - dotCover
Analyze unit tests coverage in .NET Framework projects · Make sure your unit test project is built. · Navigate to the directory where...
Read more >coverlet.console 1.0.0
Coverlet is a cross platform code coverage tool for .NET Core, with support for line, branch and method coverage.
Read more >Bookshop Example
With SpecFlow+ Runner the Name and TestCategory properties can be used to filter the acceptance tests. Tip: You can list all acceptance tests...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
This is phenomenal! Thank you so much. Looking forward to trying it out 😃
To me now it looks like a bug and the documentation doesn’t have a reference to MSBuild in general or to MSBuild escaping rules. At least maybe the documentation needs to be updated now:
https://docs.microsoft.com/en-us/dotnet/core/tools/dotnet-test?tabs=netcore21