Skip to content

Tests with a period (.) in their name are displayed incorrectly #9609

@TysonMN

Description

@TysonMN

Tests with a period (.) in their name are displayed incorrectly.

Steps to reproduce

This solution ZIP contains the following test code.

module TestNamespace.TestModule
open Xunit
[<Fact>]
let ``Test without a period in its name`` () = ()
[<Fact>]
let ``Test with a . in its name`` () = ()

Actual behavior
These tests are displayed in the test explorer like this.
2020-07-01_11-46-53_166_devenv

It is as though the namespace, module, and test names were concatenated together and then parsed back out like this.

NamespaceName.ModuleName.Test with a . in its name
        namespace       |   module   |    test

Expected behavior
I expected the parsing to be like this...

NamespaceName.ModuleName.Test with a . in its name
  namespace  |  module  |           test

...so that the tree in the solution explorer would look like this.

  • ProjectName (2)
    • NamespaceName (2)
      • ModuleName (2)
        • Test without a period in its name
        • Test with a . in its name

Known workarounds

Don't include . in a test name?

I encountered this problem while investing this issue in which a certain test passes for some target frameworks when the code under test is built with some .NET Core SDKs but fails with other choices. At one point, I considered putting in the test name how its result depends on the versions of the .NET Core SDK. In the end, I decide not to include that information in the test name.

Related information

  • Operating system: WIndows 10 Enterprise Version 10.0.18362 Build 18362
  • .NET Runtime kind: The MWE targets .NET Core 3.1 and the most recent version of the SDK that I have is 3.1.301 (x64)
  • Editing Tools: Visual Studio Enterprise 2019 Version 16.6.3

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions