Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to fail build on low test coverage with activator / sbt?

I'm working on a pure Java project with playframework 2.3 and using Jacoco4sbt as code coverage tool.
What should I do in order to get the build fail when code coverage is below a threshold ?

like image 545
ib-is Avatar asked Oct 22 '14 14:10

ib-is


1 Answers

In your project's build.sbt file just add the following

jacoco.settings ++ Seq(           
  jacoco.thresholds in jacoco.Config := Thresholds(  
  instruction = 90,   
  method = 90,  
  branch = 90,  
  complexity = 90,  
  line = 90,  
  clazz = 90)  
  )

And run at your project's root activator jacoco:cover dist

like image 125
ib-is Avatar answered Nov 07 '22 12:11

ib-is