Skip to content
This repository was archived by the owner on Mar 3, 2025. It is now read-only.

Test report into Jenkins readable format

Igor Maznitsa edited this page Aug 22, 2016 · 3 revisions

There is already developed third part utility go2xunit to make conversion of golang test console output into xunit format which can be recognized by Jenkins, since 2.1.1 version the mvn-golang plugin can save console output as files and it allows us to use below trick

<execution>
  <id>default-get</id>
  <configuration>
    <packages>
      <package>bitbucket.org/tebeka/go2xunit</package>
    </packages>
  </configuration>
</execution>                   
<execution>
    <id>default-test</id>
    <configuration>
      <buildFlags>
        <flag>-v</flag>
      </buildFlags>
      <outLogFile>test-out-verbose.log</outLogFile>
      <ignoreErrorExitCode>true</ignoreErrorExitCode>
    </configuration>
</execution>
<execution>
  <id>makeXUnitReport</id>
  <phase>test</phase>
  <goals>
    <goal>custom</goal>
  </goals>
  <configuration>
    <exec>go2xunit</exec>
    <customCommand>-fail</customCommand>
    <buildFlags>
      <flag>-input</flag>
      <flag>${project.build.directory}${file.separator}reports${file.separator}test-out-verbose.log</flag>
      <flag>-output</flag>
      <flag>${project.build.directory}${file.separator}reports${file.separator}xunit.xml</flag>
    </buildFlags>
  </configuration>
</execution>

after test we will get log files produced by golang and go2xunit will convert them into xunit format

Clone this wiki locally