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
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.
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.
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.
Try upgrading to version 1.5.1 like so
addSbtPlugin("org.scoverage" % "sbt-scoverage" % "1.5.1")
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With