VSoftTechnologies/DUnitX

Improve JUnit Output

luebbe opened this issue · 4 comments

Looking at the DUnitX JUnit output, I see that class and testcase names are always the same:

  <testsuite name="DUnitX.Tests.MemoryLeaks.TTestsMemoryLeaksReported" tests="2" disabled="0" errors="0" failures="0" time="0.006" timestamp="2021-07-23T10:23:02">
    <testcase classname="DUnitX.Tests.MemoryLeaks.TTestsMemoryLeaksReported" name="Override_No_Reporting_Of_Memory_Leaks" time="0.000">
    </testcase>
    <testcase classname="DUnitX.Tests.MemoryLeaks.TTestsMemoryLeaksReported" name="Reporting_Of_Memory_Leaks" time="0.000">
    </testcase>
  </testsuite>
  <testsuite name="DUnitX.Tests.MemoryLeaks.TTestsNoMemoryLeaksReported" tests="2" disabled="0" errors="0" failures="0" time="0.006" timestamp="2021-07-23T10:23:02">
    <testcase classname="DUnitX.Tests.MemoryLeaks.TTestsNoMemoryLeaksReported" name="No_Reporting_Of_Memory_Leaks" time="0.000">
    </testcase>
    <testcase classname="DUnitX.Tests.MemoryLeaks.TTestsNoMemoryLeaksReported" name="Override_Reporting_Of_Memory_Leaks" time="0.000">
    </testcase>
  </testsuite>

Wouldn't it make sense to split the information in unit and class name? Example:

  <testsuite name="DUnitX.Tests.MemoryLeaks" tests="2" disabled="0" errors="0" failures="0" time="0.006" timestamp="2021-07-23T10:23:02">
    <testcase classname="TTestsMemoryLeaksReported" name="Override_No_Reporting_Of_Memory_Leaks" time="0.000">
    </testcase>
    <testcase classname="TTestsMemoryLeaksReported" name="Reporting_Of_Memory_Leaks" time="0.000">
    </testcase>
  </testsuite>
  <testsuite name="DUnitX.Tests.MemoryLeaks" tests="2" disabled="0" errors="0" failures="0" time="0.006" timestamp="2021-07-23T10:23:02">
    <testcase classname="TTestsNoMemoryLeaksReported" name="No_Reporting_Of_Memory_Leaks" time="0.000">
    </testcase>
    <testcase classname="TTestsNoMemoryLeaksReported" name="Override_Reporting_Of_Memory_Leaks" time="0.000">
    </testcase>
  </testsuite>

Yes that does make sense. When you look at the NUnit output format, we do that

<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
<test-results name="C:\Users\vincent.OFFICE\Documents\Embarcadero\Studio\Projects\DunitXExcludeTest\Win32\Debug\Project3.exe" total="2" errors="0" failures="0" ignored="0" inconclusive="0" not-run="0" skipped="0" invalid="0" date="2021-07-23" time="0.001">
  <culture-info current-culture="en" current-uiculture="en" />
  <test-suite type="Assembly" name="Project3.exe" executed="true" result="Success" success="True" time="0.001" asserts="0">
    <results>
        <test-suite type="Namespace" name="Unit3" executed="true" result="Success" success="True" time="0.001" asserts="0" >
          <results>
              <test-suite type="Fixture" name="TMyTestObject" executed="True" result="Success" success="True" time="0.001" >
                <results>
                  <test-case name="Test2.TestA" executed="True" result="Success" success="True" time="0.000" asserts="0" />
                  <test-case name="Test2.TestB" executed="True" result="Success" success="True" time="0.000" asserts="0" />
                </results>
              </test-suite>
          </results>
        </test-suite>
    </results>
  </test-suite>
</test-results>

HI @luebbe

Can you add this change to PR #289 and I'll merge it. thx.

Done, Results for reference

Testresults.zip

Thanks, merged