Description
In the <clover-report> we can define <testresults> element which causes that test results are being read from JUnit-compatible XML files, instead of from Clover's coverage recording files.
This works as long as the test name can be mapped to the method name (which is usually the case). However, in case of the Spock framework, test cases are named using a free text like:
def "check if this test does xyz"
which is later translated to a method named like:
$spock_feature_0_0
As a consequence Clover is not able to match test name to the method name (in order to link to sources). It uses an empty test id to store the test result (SLICE_ID = -1). If there are more than one non-matched method in the same XML file, all get the same ID=-1, thus overwriting each other in hashmap. As a consequence only one is listed.
Fix:
Generate a unique test id using the test name - a String.hashCode() for instance.