0

When I search for what I wrote on the title the internet is completely full of results about using JUnit, JUnit5, Mockito, TestNG and whatnot.

I went over the official docs and they provide a sample with the JVM.

I went ahead and gave it a try and as soon as I add

test {
    useJUnitPlatform()
}

to my build.gradle another plugin breaks with:

Caused by: org.gradle.internal.metaobject.AbstractDynamicObject$CustomMessageMissingMethodException: Could not find method test() for arguments [build_dufjov4kr7mc23edqwrf6trov$_run_closure1@6a819f87] on project ':app' of type org.gradle.api.Project.

How do I get past that?

Some random IT boy
  • 7,569
  • 2
  • 21
  • 47

1 Answers1

0

That test block seems optional.

Just add the following dependencies:

testImplementation 'junit:junit:4.13.2'
testImplementation 'org.jetbrains.kotlin:kotlin-test'
testImplementation 'org.jetbrains.kotlin:kotlin-test-junit'

Then, in your tests, pick the correct imports, ie. import kotlin.test.assertEquals

Seems like the test block below is NOT necessary.

Nino van Hooff
  • 3,677
  • 1
  • 36
  • 52
Some random IT boy
  • 7,569
  • 2
  • 21
  • 47