formulahendry / formulahendry/vscode-dotnet-test-explorer
FullyQualifiedName does not properly escape special characters
- Dominant language
- TypeScript
- Stars
- 208
- Forks
- 93
- PR merge metrics
- No merged PRs in 30d
Description
Running an individual test that has a special character in its name will bomb due to the character not being escaped. For example:
```
[]
let ``Say Hi!`` () =
hello |> Assert.True(true)
```
will result in the following error:
```
C:\fsharp\hello-world>dotnet test --logger "trx;LogFileName=C:\Temp\test-explorer-KLRHlK\Results.trx" --filter "FullyQualifiedName~HelloWorldTest.Say Hi!"
Build started, please wait...
Build completed.
Test run for C:\fsharp\hello-world\bin\Debug\netcoreapp2.0\HelloWorld.dll(.NETCoreApp,Version=v2.0)
Microsoft (R) Test Execution Command Line Tool Version 15.7.0
Copyright (c) Microsoft Corporation. All rights reserved.
Starting test execution, please wait...
[xUnit.net 00:00:00.3667942] HelloWorld: Exception filtering tests: Incorrect format for TestCaseFilter Error: Invalid Condition 'FullyQualifiedName~HelloWorldTest.Say Hi!'. 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 filter `FullyQualifiedName~HelloWorldTest.Say Hi!` in C:\fsharp\hello-world\bin\Debug\netcoreapp2.0\HelloWorld.dll
Additionally, path to test adapters can be specified using /TestAdapterPath command. Example /TestAdapterPath:.
```
This is because the `--filter` is `FullyQualifiedName~HelloWorldTest.Say Hi!`, and the `!` is a special character. Running the same command manually with it escaped works fine:
```
C:\fsharp\hello-world>dotnet test --logger "trx;LogFileName=C:\Temp\test-explorer-KLRHlK\Results.trx" --filter "FullyQualifiedName~HelloWorldTest.Say Hi\!"
```
It looks like the special characters `!`, `=`, `|`, and `&` (and possibly others) need to be escaped if they exist in the test name.
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.