Marko Kovacevic
10/21/2020, 7:38 PMExecution failed for task ':test'.
> No tests found for given includes: [MainTest](filter.includeTestsMatching)
* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.
* Get more help at <https://help.gradle.org>
BUILD FAILED in 711ms
I saw from some answers at the top certain solutions, but some were hacky (switch to InteliJ instead of Gradle for testing) and some changed over time (1year diff).
Test file is simple and present in src/test/kotlin/MainTest.kt
. Source is from src/kotlin/main.kt
.
import org.junit.jupiter.api.Test
import kotlin.test.assertEquals
class MainTest {
@Test
fun shouldWork() {
assertEquals(add(1, 3), 4)
}
}
UPDATE
Solved by updating dependencies for test
dependencies {
implementation(kotlin("test-junit"))
...
}
and removed the following and similar tasks:
tasks {
withType<Test> {
useJUnitPlatform()
}
}