@jheimbuck_gl i was on the verge of giving up, but i finally got line-by-line coverage display working – thanks to the comment by @rlaw_doctible below this other thread’s comment: Enabling cobertura - #15 by rodneyrehm
I had to add this script to then end our visualization step:
# replace <source> tag content with ./ (otherwise gitlab cannot map the paths to src)
- sed -i "s=<source>.*src/main/java</source>=<source>./</source>=g" target/site/cobertura.xml
This corrects the <source>
-tag content in the cobertura.xml to read:
<source>./</source>
instead of
<source>src/main/java</source>
…which makes sense: if that source path is applied to the filename-path, we end up with paths starting with src/main/java/src/main/java/{code/under/test}.java
and therefore gitlab cannot correctly map them.
My suggestion would be either to add the additional sed-fu to the example in the documentation, or @haynes could modify source2filename.py
in their repository (which is a must-have requirement anyway in order to achieve the line-by-line coverage display) to fix the <source>
-tag content as well.