Hi, everyone. Did anyone encounter issue when star...
# getting-started
m
Hi, everyone. Did anyone encounter issue when starting a blank Kotlin console application via InteliJ with an error after trying to run tests via InteliJ:
Copy code
Execution 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
.
Copy code
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
Copy code
dependencies {
    implementation(kotlin("test-junit"))
    ...
}
and removed the following and similar tasks:
Copy code
tasks {
    withType<Test> {
        useJUnitPlatform()
    }
}
🙌 1
🏳️‍🌈 1