Skip to content

Commit 53344cf

Browse files
Merge pull request #36 from AbsaOSS/feature/35-add-code-coverage-support
#35 - Add code coverage support - Added support for generation of code coverage report.
2 parents 1e0b213 + a2769b1 commit 53344cf

File tree

3 files changed

+25
-0
lines changed

3 files changed

+25
-0
lines changed

README.md

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,16 @@ To use the extensions you need to add this import to your Spark application or s
4040
import za.co.absa.spark.hats.Extensions._
4141
```
4242

43+
### How to generate Code coverage report
44+
```sbt
45+
sbt jacoco
46+
```
47+
Code coverage will be generated on path:
48+
```
49+
{local-path}\spark-hats\target\scala-2.XY\jacoco\report\html
50+
```
51+
52+
4353
## Motivation
4454

4555
Here is a small example we will use to show you how `spark-hats` work. The important thing is that the dataframe

build.sbt

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,3 +48,17 @@ lazy val hats = (project in file("."))
4848
// release settings
4949
releaseCrossBuild := true
5050
addCommandAlias("releaseNow", ";set releaseVersionBump := sbtrelease.Version.Bump.Bugfix; release with-defaults")
51+
52+
// JaCoCo code coverage
53+
Test / jacocoReportSettings := JacocoReportSettings(
54+
s"spark-hats Jacoco Report - ${scalaVersion.value}",
55+
None,
56+
JacocoThresholds(),
57+
Seq(JacocoReportFormats.HTML, JacocoReportFormats.XML),
58+
"utf-8")
59+
60+
// exclude example
61+
Test / jacocoExcludes := Seq(
62+
// "za.co.absa.spark.hats.transformations.NestedArrayTransformation*", // class and related objects
63+
// "za.co.absa.spark.hats.transformations.ArrayContext" // class only
64+
)

project/plugins.sbt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,4 +17,5 @@
1717
addSbtPlugin("com.jsuereth" % "sbt-pgp" % "2.0.0")
1818
addSbtPlugin("com.github.gseitz" % "sbt-release" % "1.0.12")
1919
addSbtPlugin("de.heikoseeberger" % "sbt-header" % "5.6.0")
20+
addSbtPlugin("com.github.sbt" % "sbt-jacoco" % "3.4.0")
2021

0 commit comments

Comments
 (0)