~/talk

Get a Cool Unit Test Environment with Spek2 + MockK + JaCoCo

TalkinJapaneseat DroidKaigi 2019 · 2019-02-07..02-08· [testing, kotlin]
links:none on file
slides:none on file

Kotlin unit-test setup using Spek2 (an RSpec-like DSL on JUnit5) with MockK for mocking final classes, singletons and extension functions, and JaCoCo for coverage. Shows exact Gradle changes: apply the kotlin-open plugin, add the JUnit5 engine plus junit-vintage for JUnit4 coexistence, register the Spek2 engine, and create Gradle tasks that run tests and generate/merge JaCoCo multi-module HTML and XML reports. Includes demos of mocking a singleton and an extension function and verifies the coverage reports are produced correctly.

AI-written summary · about

  1. 0:00Introduction
  2. 2:28Unit test challenges
  3. 4:55Kotlin test libraries
  4. 5:40MockK intro
  5. 10:02MockK pros/cons
  6. 12:38MockK for singletons
  7. 14:28Spek2 intro
  8. 17:44Spek2 vs JUnit4
  9. 19:19Test environment demo
  10. 21:59JaCoCo coverage
  11. 28:30Summary
~/search
type to search 6,249 conferences, 138,987 speakers and 185,172 talks
~/help
cmdctrl k
search every conference, speaker and series
/
focus the filter search
h
home
c
conferences
s
speakers
e
series
t
light / dark — the status bar button does the same
?
this help
esc
close this, then clear every filter — or just the search, while you are typing in it

Ignored while you are typing. Pages without a filter rail have no search to focus.