Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to break the build if test coverage fails minimum threshold?

We want to fail the build on codeship if test coverage goes below the threshold value. But it is not failing the build.

Scoverage Plugin:

addSbtPlugin("org.scoverage" % "sbt-scoverage" % "1.3.5")

Added following two statements in build.sbt

coverageMinimum := 80,
coverageFailOnMinimum := true

It is not failing even in local if test coverage is below 80. The command I run is

sbt clean coverage test coverageReport
like image 368
Mahesh Chand Avatar asked Oct 15 '22 15:10

Mahesh Chand


People also ask

How can I improve my test coverage?

Tips to perform test coverageMake appropriate test cases that cover the maximum test scenarios required based on the current release. Perform testing before the release so that the focus is provided to cover more scenarios in less time on a scheduled basis.

What is the minimum test coverage?

Minimum Test Coverage Rate: Keeping it between 60 - 70%. Optimal Test Coverage Rate: Keeping it between 70 - 80%. Overkill Test Coverage Rate: Keeping it between 80 - 100%. N.B: The above are my personal opinion and it may vary depending upon specific system design or requirements.

How do you get 100 percent test coverage?

100% test coverage simply means you've written a sufficient amount of tests to cover every line of code in your application. That's it, nothing more, nothing less. If you've structured your tests correctly, this would theoretically mean you can predict what some input would do to get some output.


1 Answers

Try upgrading to version 1.5.1 like so

addSbtPlugin("org.scoverage" % "sbt-scoverage" % "1.5.1")
like image 125
Mario Galic Avatar answered Oct 21 '22 00:10

Mario Galic