visualstudio.xunit icon indicating copy to clipboard operation
visualstudio.xunit copied to clipboard

dotnet-test logger outputs wrong classname for tests with [Fact]

Open estiller opened this issue 7 years ago • 1 comments

Hi, When running xUnit unit tests with the dotnet test command and using a logger, it appears that class names for tests marked with [Fact] are not output correctly in the test results file. This has an adverse effect on automated tools performing analysis on the results file.

How to reproduce: A simple repro project is available at https://github.com/estiller/XunitIssueRepro Simply clone the repo, and create a test results file with: dotnet test --logger "trx;LogFileName=path\results.trx" For simplicity, I included the .trx file I got within the repo.

Expected behavior: I expect that in the test results file, all className attributes will be correct.

Actual behavior: Class names for tests marked with [Fact] are wrong. If you look at https://github.com/estiller/XunitIssueRepro/blob/master/TestResults.trx#L18 then you will see that the className attribute's value is XunitIssueRepro while it should be XunitIssueRepro.TestClass like in https://github.com/estiller/XunitIssueRepro/blob/master/TestResults.trx#L14 which is correct for a test marked with [Theory] instead of [Fact].

estiller avatar Dec 13 '18 20:12 estiller

I think this is also true for [MemberData]

cheng93 avatar Apr 18 '19 22:04 cheng93

Not sure if this still a problem, but TRX output is controlled by VSTest, not by us.

bradwilson avatar May 27 '23 20:05 bradwilson