Skip to content

methodformat always includes namespace and class name regardless of setting #30

@moly

Description

@moly

I'm using junit.testlogger 2.1.78 and dotnet 3.1.402.

I have a test class called LayerConverterTest in a directory test/MyProject.Test/Json. It's namespace is MyProject.Test.Json

If I run dotnet test --no-build --logger:"junit;LogFilePath=..\artifacts\{assembly}-test-result.xml;MethodFormat=Default;FailureBodyFormat=Verbose"

The resulting report wrongly includes the full namespace and class in the name attribute.

<?xml version="1.0" encoding="utf-8"?>
<testsuites>
  <testsuite name="MyProject.Test.dll" tests="4" skipped="0" failures="0" errors="0" time="0.1136953" timestamp="2020-10-01T11:23:36" hostname="executor://xunit/VsTestRunner2/netcoreapp" id="0" package="MyProject.Test.dll">
    <properties />
    <testcase classname="MyProject.Test.Json.LayerConverterTest" name="MyProject.Test.Json.LayerConverterTest.CanConvert_LayerSubclass_True(type: typeof(MyProject.Json.Layers.Image))" time="0.0070400" />
    <testcase classname="MyProject.Test.Json.LayerConverterTest" name="MyProject.Test.Json.LayerConverterTest.CanConvert_LayerSubclass_True(type: typeof(MyProject.Json.Layers.PreComp))" time="0.0000645" />
    <testcase classname="MyProject.Test.Json.DataTest" name="MyProject.Test.Json.DataTest.Deserialise_ValidJson_PropsPopulated" time="0.0544729" />
    <testcase classname="MyProject.Test.Json.LayerConverterTest" name="MyProject.Test.Json.LayerConverterTest.Read_ImageJson_ReturnImageObject" time="0.0521179" />
    <system-out>Junit Logger does not log standard output</system-out>
    <system-err>Junit Logger does not log error output</system-err>
  </testsuite>
</testsuites>

If I change the method format and run dotnet test --no-build --logger:"junit;LogFilePath=..\artifacts\{assembly}-test-result.xml;MethodFormat=Full;FailureBodyFormat=Verbose"

The resulting report includes the namespace and class name twice.

<?xml version="1.0" encoding="utf-8"?>
<testsuites>
  <testsuite name="MyProject.Test.dll" tests="4" skipped="0" failures="0" errors="0" time="0.0837441" timestamp="2020-10-01T11:46:24" hostname="executor://xunit/VsTestRunner2/netcoreapp" id="0" package="MyProject.Test.dll">
    <properties />
    <testcase classname="MyProject.Test.Json.LayerConverterTest" name="MyProject.Test.Json.LayerConverterTest.MyProject.Test.Json.LayerConverterTest.CanConvert_LayerSubclass_True(type: typeof(MyProject.Json.Layers.Image))" time="0.0107667" />
    <testcase classname="MyProject.Test.Json.LayerConverterTest" name="MyProject.Test.Json.LayerConverterTest.MyProject.Test.Json.LayerConverterTest.CanConvert_LayerSubclass_True(type: typeof(MyProject.Json.Layers.PreComp))" time="0.0000384" />
    <testcase classname="MyProject.Test.Json.DataTest" name="MyProject.Test.Json.DataTest.MyProject.Test.Json.DataTest.Deserialise_ValidJson_PropsPopulated" time="0.0395664" />
    <testcase classname="MyProject.Test.Json.LayerConverterTest" name="MyProject.Test.Json.LayerConverterTest.MyProject.Test.Json.LayerConverterTest.Read_ImageJson_ReturnImageObject" time="0.0333726" />
    <system-out>Junit Logger does not log standard output</system-out>
    <system-err>Junit Logger does not log error output</system-err>
  </testsuite>
</testsuites>

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions