File tree Expand file tree Collapse file tree 1 file changed +19
-0
lines changed Expand file tree Collapse file tree 1 file changed +19
-0
lines changed Original file line number Diff line number Diff line change 44Scales is a free Apache licensed code coverage tool for scala that offers statement and branch coverage.
55Scales is available for both maven and sbt.
66
7+ ### Statement Coverage
8+
9+ In traditional code coverage tools, line coverage has been the main metric.
10+ This is fine for languages such as Java which are very verbose and very rarely have more than one
11+ statement per line, and more usually have one statement spread across multiple lines.
12+
13+ In powerful, expressive languages like Scala, quite often multiple statements, or even branches
14+ are included on a single line, eg a very simple example:
15+
16+ ```
17+ val status = if (age < 18) "No beer" else "Beer for you"
18+ ```
19+
20+ If you had a unit test that ran through the value 18 you would get 100% line coverage
21+ yet you only have 50% statement coverage
22+
23+ That's why in Scales we focus on statement coverage, and don't even include line coverage as a metric.
24+ This is a paradigm shift that we hope will take hold.
25+
726
827### Alternatives
928
You can’t perform that action at this time.
0 commit comments