spekt / xunit.testlogger

XUnit logger for vstest platform
MIT License
73 stars 15 forks source link

No traits when updating to 3.0.56 #32

Closed zplan closed 3 years ago

zplan commented 3 years ago

I have custom traits in my test projects. When I run the tests with xunit.testlogger 2.1.45 it looks like:

Test-Code:

        [Id("A3713657-3102-4A02-9D83-A4B1838CD252")]
        [Scenario(DisplayName = "MyTestName")]
        public void MyTestName()

Output xml:

<assemblies timestamp="02/03/2021 09:08:48">
  <assembly name="C:\myproject\TestAssembly.dll" run-date="2021-02-03" run-time="09:08:48" total="119" passed="119" failed="0" skipped="0" time="17.629" errors="0">
    <errors />
    <collection total="39" passed="39" failed="0" skipped="0" name="Test description" time="0.546">
      <test name="mytestname" type="TestAssembly" method="TestMethod" time="0.0121610" result="Pass">
        <traits>
          <trait name="ID" value="A3713657-3102-4A02-9D83-A4B1838CD252" />
        </traits>
      </test>
      <test name="mytestname 2" type="TestAssembly" method="TestMethod" time="0.0621371" result="Pass">
        <traits>
          <trait name="ID" value="A3713657-3102-4A02-9D83-A4B1838CD252" />
        </traits>
      </test>
      ....

After updating to 3.0.56 the traits are gone:

<assemblies timestamp="02/03/2021 09:08:48">
  <assembly name="C:\myproject\TestAssembly.dll" run-date="2021-02-03" run-time="09:08:48" total="119" passed="119" failed="0" skipped="0" time="17.629" errors="0">
    <errors />
    <collection total="39" passed="39" failed="0" skipped="0" name="Test description" time="0.546">
      <test name="mytestname" type="TestAssembly" method="TestMethod" time="0.0121610" result="Pass">
        <traits />
      </test>
      <test name="mytestname 2" type="TestAssembly" method="TestMethod" time="0.0621371" result="Pass">
        <traits />
      </test>
      ....

I can't see a breaking change in the changelog.

Is this a bug or is a change needed?

codito commented 3 years ago

@zplan thanks for reporting, this appears to be a bug. v2.1.45 used result.TestCase.Traits (https://github.com/spekt/xunit.testlogger/blob/v2.1.45/src/Xunit.Xml.TestLogger/XunitXmlTestLogger.cs#L151) and v3.0.56 uses result.Traits (https://github.com/spekt/testlogger/blob/master/src/TestLogger/Core/TestResultInfo.cs#L54). Working on a fix.

codito commented 3 years ago

Pushed v3.0.62 to nuget.

zplan commented 3 years ago

@codito hey, that was fast, thanks! It is working now with version 3.0.62! Great job.