Skip to content

Junit XML can't be parsed when test case or test suite names contain invalid XML chars #285

Closed
@sfc-gh-abalik

Description

@sfc-gh-abalik

With a ParameterizedTest it is possible to generate test case names with invalid XML characters. E.g.

@ParameterizedTest
@ValueSource(strings = {"Weird\bname"})
void testFoo(String input) {
    ...
}

The test case name is derived from the input string, which in this case contains an invalid XML char \b. When tools (like IDEs) try to parse the junit XML, they'll fail due to the invalid char.

It looks like this could also happen for test suite names.

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