o-0
o-0

Reputation: 1789

Setting Scoverage Criteria

Is there a way I could setup a test coverage criteria while running scoverage? Right now I execute the usual following command:

sbt test coverage 

This way I get the result but would like to hard code a criteria; for example statement coverage of 50 percent or branch coverage of 70 percent.

Upvotes: 1

Views: 431

Answers (1)

Mahesh Chand
Mahesh Chand

Reputation: 3250

You can set statement coverage threshold on your build setting. If there will be less coverage compare to threshold coverage, it will break the build.

You can set the coverage threshold by adding in your settings of build.sbt

coverageMinimum := 90,
coverageFailOnMinimum := true,

As @mukesh has mentioned in a comment, we can also specify threshold for all multi-projects in the same build by adding above statements.

Upvotes: 2

Related Questions