Skip to content

Add support for custom properties in generated junit reports #153

@timo-reymann

Description

@timo-reymann

Is your feature request related to a problem? Please describe.
Currently, the JUnit logger only allows logging the default fields.

JUnit supports adding custom properties for test cases, so e.g., the corresponding XML looks like this:

<testsuites tests="1" failures="2" skipped="3" errors="4" time="5.6">
	<testsuite name="MyTest" timestamp="2025-02-06T09:48:35.147Z" tests="1" failures="0" skipped="0" time="1.467" errors="0">
		<testcase name="My Test Case" classname="MyTest" time="6.467">
			<properties>
				<property name="team" value="My team name"></property>
                                <property name="type" value="integration"></property>
			</properties>
		</testcase>
	</testsuite>
</testsuites>

Describe the solution you'd like
Traits can be picked up by the test logger and added as properties.

Depending on the framework, so for ...

... xUnit

[Trait("team", "My team name")]
[Trait("type", "integration")]
class MyTestSuite {
 // tests here
}

... NUnit

[Category("team", "My team name")]
[Category("type", "integration")]
class MyTestSuite {
 // tests here
}

the according trait would be parsed. Eventually this can be made configurable so it would work with any type of decorator?

Describe alternatives you've considered
I could extend the JUnit XML logger, unfortunately, all functionality is private and it's difficult to customize / e.g., add the package as a dependency and customize the logger.

If you opened that up, customization would be possible here, by simply extending that.

Metadata

Metadata

Assignees

No one assigned

    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