microsoft / MSBuildSdks

MSBuild project SDKs
MIT License
449 stars 80 forks source link

[RunVSTest] Some test display names cause failures #543

Open dfederm opened 6 months ago

dfederm commented 6 months ago

To repro:

dotnet new mstest
dotnet add package Microsoft.Build.RunVSTest --prerelease

Then add this test:

[TestClass]
public class UnitTest1
{
    [DataTestMethod]
    [DataRow("Something error:")]
    public void TestMethod1(string errorMessage)
    {
        Assert.IsNotNull(errorMessage);
    }
}

Output:

RUNVSTESTTASK : Passed TestMethod1 (Something error : ) [< 1 ms]

image

The test actually passes though, and you can see this by running dotnet test:

image

It seems like something about "Something error:" being in the test "name" (data tests have the data in the names by default) which is causing something to interpret the console spew as an error.

@novacole