One such plugin is Jacoco4sbt, which wires the JaCoCo code-coverage tool into SBT (the build system for Play apps). Configuration is pretty straightforward, and the generated HTML report is a nice way to target untested corners of your code. The only downside (which I've finally got around to looking at fixing) was that by default, a lot of framework-generated code is included in your coverage stats.
So without further ado, here's a stanza you can add to your Play app's build.sbt to whittle down your coverage report to code you actually wrote:
jacoco.settings
jacoco.excludes in jacoco.Config := Seq(
"views*",
"*Routes*",
"controllers*routes*",
"controllers*Reverse*",
"controllers*javascript*",
"controller*ref*",
"assets*"
)
I'll be putting this into all my Play projects from now on. Hope it helps someone.
No comments:
Post a Comment
Comments welcome - spam is not. Spam will be detected, deleted and the source IP blocked.