Test coverage visualization not work

hello,
I config test coverage visualization according to Maven example in Test coverage visualization | GitLab, but when the pipeline tasks finished, there is still no test coverage info on the merge request diff page.
My GitLab version is “GitLab Enterprise Edition 13.6.7-ee”, and content in cobertura.xml is like the following, because it is a private project, so I replace some key info.

	<coverage timestamp="1626956500.575" line-rate="0.18101287702013655" branch-rate="0.04351694572514762" complexity="13964.0">
  <sources>
    <source>/builds/a/b/c/d-common/src/main/java/</source>
    <source>/builds/a/b/c/d-dao/src/main/java/</source>
    <source>/builds/a/b/c/d-portal/src/main/java/</source>
    <source>/builds/a/b/c/d-alarm/src/main/java/</source>
  </sources>
  <packages>
    <package name="com.a.b.c.configurer" line-rate="0.772020725388601" branch-rate="0.425" complexity="52.0">
      <classes>
        <class name="com.a.b.c.configurer.SchedulerConfig$1" filename="/builds/a/b/c/d-common/src/main/java//com/a/di/c/configurer/SchedulerConfig.java" line-rate="1.0" branch-rate="1.0" complexity="3.0">
          <methods>
            <method name="&lt;init&gt;" signature="(Lcom/a/di/c/configurer/SchedulerConfig;Ljava/util/concurrent/ScheduledThreadPoolExecutor;)V" line-rate="1.0" branch-rate="0.0" complexity="1.0">
              <lines>
                <line number="46" hits="1" branch="false"/>
              </lines>
            </method>

is there any issue with my cobertura.xml? Thank you in advance for any help.

@bingbing.wang - Welcome to the forum and thanks for the post!

Unfortunately there is not support for multiple source directories today. There is an open issue for this capability but it is not currently scheduled.

If the filename has the full path to the source, which it appears yours does but with an extra / the feature should work. Hopefully this helps!

-James H, GitLab Product Manager, Verify:Testing

@jheimbuck_gl Thanks for your reply, will the feature of test coverage visualization be turned on by default in GitLab Enterprise Edition 13.6.7-ee?

@bingbing.wang - Yep it was enabled by default starting in 13.5. The Version History in the GitLab docs will usually have this information for a feature.

-James H, GitLab Product Manager, Verify:Testing

so weird, still not work

There have been several bug fixes made, most recently in 13.9, as well as the automatic class path correction that was not enabled by default until the 13.9 milestone as well.

There have been several threads in this forum that may also help you in troubleshooting any further issues. If you’re on a paid support plan I would suggest opening a support ticket as well.

I hope this helps!

-James H, GitLab Product Manager, Verify:Testing

Thanks, @jheimbuck_gl, I refer to another thread and change my code as following, and it works.

	<coverage timestamp="1626956500.575" line-rate="0.18101287702013655" branch-rate="0.04351694572514762" complexity="13964.0">
  <sources>
    <source>d-common/src/main/java/</source>
    <source>d-dao/src/main/java/</source>
    <source>d-portal/src/main/java/</source>
    <source>d-alarm/src/main/java/</source>
  </sources>
  <packages>
    <package name="com.a.b.c.configurer" line-rate="0.772020725388601" branch-rate="0.425" complexity="52.0">
      <classes>
        <class name="com.a.b.c.configurer.SchedulerConfig$1" filename="d-common/src/main/java//com/a/di/c/configurer/SchedulerConfig.java" line-rate="1.0" branch-rate="1.0" complexity="3.0">
          <methods>
            <method name="&lt;init&gt;" signature="(Lcom/a/di/c/configurer/SchedulerConfig;Ljava/util/concurrent/ScheduledThreadPoolExecutor;)V" line-rate="1.0" branch-rate="0.0" complexity="1.0">
              <lines>
                <line number="46" hits="1" branch="false"/>
              </lines>
            </method>
1 Like