javasbtcode-coverageplayframework-2.3typesafe-activator

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 ?


Solution

  • 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