fbpx

Libraries for Kotlin & JVM Testing


I’ll be updating this entry with new libraries and version updates. To make sure that you don’t miss anything, subscribe to newsletter and bookmark this page.

Frameworks

JUnit4

project website

dependencies {
    testImplementation "junit:junit:4.13.2"
}

JUnit5

project website

test {
    useJUnitPlatform()
}

dependencies {
	testImplementation "org.junit.jupiter:junit-jupiter:5.8.0"

}

Junit4 & Junit5 in one project

Add junit vintage

test {
    useJUnitPlatform()
}

dependencies {
    testImplementation "org.junit.jupiter:junit-jupiter:5.8.0"
    testImplementation "junit:junit:4.13.2"
    testImplementation "org.junit.vintage:junit-vintage-engine:5.8.0"
}

Kotest

project website

test {
  useJUnitPlatform()
}

dependencies {
  testImplementation 'io.kotest:kotest-runner-junit5:5.0.0>'

}

Spring Boot Starter Test

dependencies {
	testImplementation 'org.springframework.boot:spring-boot-starter-test'

}

Mocking

Mockito

project website

dependencies{
    testImplementation 'org.mockito:mockito-core:4.1.0'
}

Mockito-Kotlin

project website

dependencies{
    testImplementation "com.nhaarman.mockitokotlin2:mockito-kotlin:4.0.0"
}

MockK

project website

dependencies {
   testImplementation 'io.mockk:mockk:1.12.1'
}

Assertions

Kotest

dependencies {
  //assertions
  
  testImplementation 'io.kotest:kotest-assertions-core:5.0.0' 
  //property testing
  
  testImplementation 'io.kotest:kotest-property:5.0.0' 
}

Strikt

project website

dependencies {
	testImplementation "io.strikt:strikt-core:0.33.0"
}

AssertJ

project website

dependencies {
	testImplementation 'org.assertj:assertj-core:3.21.0'
}

Truth

dependencies {
	testImplementation 'com.google.truth:truth:1.1.3'
}

more insights

Uncategorized
Jarosław Michalik

#kotlinDevChallenge 2023 summary

The KotlinDevChallenge was not just a competition, but a journey of learning, growth, and community engagement. Every participant in this challenge is a winner in

Read More »
KotlinDevChallenge2023
Jarosław Michalik

#kotlinDevChallenge – 24

What do you love most about Kotlin? Productivity increase? Idioms? Or that it isn’t Java? Maybe something else! Share it. It can be short. It

Read More »

AndroidPro newsletter 🚀

join 3057 developers reading AndroidPro newsletter every week

👉 tips & tricks, articles, videos

👉 every Thursday in your inbox

🎁 bonus on signup – Clean Architecture blueprint

brought to you by Jarek Michalik, Kotlin GDE

You can unsubscribe any time. For details visit our privacy policy.

android pro newsletter tips and tricks how to learn android