Your browser was unable to load all of the resources. They may have been blocked by your firewall, proxy or browser configuration.
Press Ctrl+F5 or Ctrl+Shift+R to have your browser try again.

Get JUnit Report Data with groovy #3970

Laba42 ·

I need for our test team the build statitic and the JUnit test xml export.

With these rest calls i get the builtd statistic results
http://QBSERVER:8810/rest/junit/buildstats/88523/SureFireReport

<report name="stats" version="3.1" locale="de_DE">
  <row ID="1" buildId="88523" duration="5000103" tests="4463" errors="10" failures="3" 
  skips="154" added="0" newFailed="0" notFixed="13" fixed="0" successes="4296" success_rate="0.962581223392337"/>
</report>

and with this call http://QBSERVER:8810/rest/junit/records/tests/88523/SureFireReport?limit=4463
i get the xml content

now i try to get these data with groovy but i get no result.

groovy:
import com.pmease.quickbuild.Context

def newBuild  = system.buildManager.load(88523)
// only to check if this is the right build
Context.getLogger().debug("Description = " + newBuild.getDescription() );

def reportMap = newBuild.getReports()
Context.getLogger().debug("Size = " + reportMap.size()  );
reportMap.each{ k, v -> 
   Context.getLogger().debug( k + " : " + v  );
}

The result map is empty.
Can you tell me how to get the JUNIT test results with groovy?

From your API documentation


com.pmease.quickbuild.model.Build
getReports()
public java.util.Map<java.lang.String,java.lang.Object> getReports()
Get reports data of this build. Key of the map represents report name, and value of the map represents data of that report. This report data can be used to render build notification templates. Refer to documentation of various reports plugin on how to use the report data.


I haven't found anything suitable in the documentation

  • solved #3
  • replies 2
  • views 566
  • stars 0
steveluo ADMIN ·

@Laba42 The report map is only available for current build. So you are not able to read reports from a build object which is loaded by BuildManager

Laba42 ·

Okay
Loading with the build manager was actually only for testing so I had to run a build with JUnit test every time.