CTest JUnit reporter should split class- and testnames
Current behavior:
xml.Attribute("name", result.Name);
xml.Attribute("classname", result.Name);
The test name is used verbatim as both name
and classname
.
The Java classpath-like structure of classname
is commonly used by consumers of this format to provide a hierarchical view, so properly splitting the input name provides a real benefit to the usability.
Replicating the name
attribute into the classname
attribute is troublesome in such case, as the name attribute is likely to contain characters which are handled inconsistently among the various JUnit consumers.
Expected behavior:
classname
contains only Java classpath like name components. In the original format, a valid, full test identifier matches ^(([a-z0-9_$]+)\.)*([^\.]+)*$
. The first clause, excluding the trailing .
forms the classname
, and everything after the last .
forms the name
of the test.
Since CMake isn't primarily used for Java, C++ / CMake style namespace separators (::
) should possibly be converted to .
prior to splitting the class path.
Minor deviations from the strict Java compatible character class in the first clause are usually handled gracefully. A "good enough" solution would be to perform the mentioned substitution, and then perform a split at the last occurrence of .
.
An empty classname
is not legal, in that case a default class name (e.g. global
) is a valid option. classname
requires a minimum of 1 path components.