22
33![ build] ( https://github.com/scoverage/scalac-scoverage-plugin/workflows/build/badge.svg )
44[ ![ Gitter] ( https://img.shields.io/gitter/room/scoverage/scoverage.svg )] ( https://gitter.im/scoverage/scoverage )
5- [ ![ Maven Central] ( https://img.shields.io/maven-central/v/org.scoverage/scalac-scoverage-plugin_2.10.svg?label=latest%20release%20for%202.10 )] ( http://search.maven.org/#search|ga|1|g%3A%22org.scoverage%22%20AND%20a%3A%22scalac-scoverage-plugin_2.10%22 )
65[ ![ Maven Central] ( https://img.shields.io/maven-central/v/org.scoverage/scalac-scoverage-plugin_2.11.12.svg?label=latest%202.11%20Scala%20support%20[2.11.12]%20and%20latest%20version )] ( http://search.maven.org/#search|ga|1|g%3A%22org.scoverage%22%20AND%20a%3A%22scalac-scoverage-plugin_2.11.12%22 )
7- [ ![ Maven Central] ( https://img.shields.io/maven-central/v/org.scoverage/scalac-scoverage-plugin_2.12.14.svg?label=2.12%20Scala%20support%20 )] ( http://search.maven.org/#search|ga|1|g%3A%22org.scoverage%22%20AND%20a%3A%22scalac-scoverage-plugin_2.12.15%22 )
8- [ ![ Maven Central] ( https://img.shields.io/maven-central/v/org.scoverage/scalac-scoverage-plugin_2.13.6.svg?label=2.13%20Scala%20support%20 )] ( http://search.maven.org/#search|ga|1|g%3A%22org.scoverage%22%20AND%20a%3A%22scalac-scoverage-plugin_2.13.6%22 )
6+ [ ![ Maven Central] ( https://img.shields.io/maven-central/v/org.scoverage/scalac-scoverage-plugin_2.12.16.svg?label=2.12%20Scala%20support%20 )] ( http://search.maven.org/#search|ga|1|g%3A%22org.scoverage%22%20AND%20a%3A%22scalac-scoverage-plugin_2.12.16%22 )
7+ [ ![ Maven Central] ( https://img.shields.io/maven-central/v/org.scoverage/scalac-scoverage-plugin_2.13.8.svg?label=2.13%20Scala%20support%20 )] ( http://search.maven.org/#search|ga|1|g%3A%22org.scoverage%22%20AND%20a%3A%22scalac-scoverage-plugin_2.13.8%22 )
8+ [ ![ Maven Central] ( https://img.shields.io/maven-central/v/org.scoverage/scalac-scoverage-domain_3.svg?label=3%20Scala%20support%20 )] ( http://search.maven.org/#search|ga|1|g%3A%22org.scoverage%22%20AND%20a%3A%22scalac-scoverage-domain_3%22 )
99[ ![ License] ( http://img.shields.io/:license-Apache%202-red.svg )] ( http://www.apache.org/licenses/LICENSE-2.0.txt )
1010
1111scoverage is a free Apache licensed code coverage tool for Scala that offers
@@ -14,12 +14,14 @@ statement and branch coverage. scoverage is available for
1414[ Maven] ( https://github.com/scoverage/scoverage-maven-plugin ) , and
1515[ Gradle] ( https://github.com/scoverage/gradle-scoverage ) .
1616
17- To see scoverage in action check out the
18- [ samples] ( https://github.com/scoverage/scoverage-samples ) project which shows
19- you covered and non-covered statements, along with an upload to coveralls.
2017
21- ![ Screenshot of scoverage report html] ( misc/screenshot2.png )
18+ ** NOTE** : That this repository contains the Scala compiler plugin for Code coverage
19+ in Scala 2 and other coverage utilities for generating reports. For Scala 3 code
20+ coverage the [ compiler] ( https://github.com/lampepfl/dotty ) natively produces
21+ code coverage output, but the reporting logic utilities are then shared with the
22+ Scala 2 code coverage utilities in this repo.
2223
24+ ![ Screenshot of scoverage report html] ( misc/screenshot2.png )
2325
2426### Statement Coverage
2527
@@ -31,19 +33,19 @@ In powerful, expressive languages like Scala, quite often multiple statements, o
3133are included on a single line, eg a very simple example:
3234
3335```
34- val status = if (age < 18) "No beer" else "Beer for you"
36+ val status = if (Color == Red) Stop else Go
3537```
3638
37- If you had a unit test that ran through the value 18 you would get 100% line coverage
39+ If you had a unit test that ran through the Color Red you would get 100% line coverage
3840yet you only have 50% statement coverage.
3941
4042Let's expand this example out to be multifacted, albeit somewhat contrived:
4143
4244```
43- val status = if (religion == "Pentecostalist") "Beer forbidden" else if (age < 18) "Underage" else "Beer for you"
45+ val status = if (Color == Red) Stop else if (Sign == Stop) Stop else Go
4446```
4547
46- Now we would get 100% code coverage for passing in the values ("Buddhist", 34 ).
48+ Now we would get 100% code coverage for passing in the values (Green, SpeedLimit ).
4749
4850That's why in scoverage we focus on statement coverage, and don't even include line coverage as a metric.
4951This is a paradigm shift that we hope will take hold.
0 commit comments