having a little trouble getting tests to run in su...
# kotest
p
having a little trouble getting tests to run in sub sub project, eg: https://docs.gradle.org/current/userguide/intro_multi_project_builds.html#sec:multiproject_build_and_test … it would be
:services:shared:test
i can see them being compiled to 
/services/shared/build/classes/kotlin/test/
   … they are located in 
/services/shared/src/test/kotlin
 (edited)
all other tests runs fine … 
/services/
 itself has no tests
using 
./gradlew -i --rerun-tasks :services:shared:clean :services:shared:test
reults in
SUCCESS: Executed 0 tests in 1.7s
in my root project i have
Copy code
subprojects {
    tasks.withType<Test> {
        useJUnitPlatform()
    }
}
s
Is this kotest you're using ?
p
yes 🙂
s
JVM or multi platform
p
JVM
Copy code
Gradle Test Executor 25 STANDARD_OUT
    ~~~ Kotest Configuration ~~~
    -> Parallelization factor: 1
    -> Concurrent specs: null
    -> Global concurrent tests: 1
    -> Dispatcher affinity: true
    -> Default test timeout: 600000ms
    -> Default test order: Sequential
    -> Default isolation mode: SingleInstance
    -> Global soft assertions: false
    -> Write spec failure file: false
    -> Fail on ignored tests: false
    -> Spec execution order: SpecExecutionOrder
    -> Include test scope affixes: null
    -> Remove test name whitespace: false
    -> Append tags to test names: false
    -> Extensions
      - io.kotest.engine.extensions.SystemPropertyTagExtension
      - io.kotest.core.extensions.RuntimeTagExtension
      - io.kotest.engine.extensions.RuntimeTagExpressionExtension


SUCCESS: Executed 0 tests in 1.5s
4.4.1
s
Take a look at this JVM project of mine that uses kotest https://github.com/sksamuel/hoplite
You should be able to use the gradle files, or get inspiration from them
p
do you have any sub-sub-projects in there? don’t see any at first glance
s
no
sorry I didn't spot that
I don't know why it would be different. Maybe subprojects {} only goes one level deep?
p
yea i even tried add the same subproject stanza to
:service
but no dice
w
I have sub-subprojects and haven’t had issues with Kotest
👍 1
You can try
./gradlew -i --rerun-tasks :services:shared:test
without
clean
task, you don’t really need it with
--rerun-tasks
anyway
(btw you want to use
Copy code
tasks.withType<Test>().configureEach { }
to benefit from lazy task configuration)
p
yea just making sure it’s not skipping due to cache .. but none of the permutations works 😞
w
yeah
--rerun-tasks
alone makes sure there’s no caching or up-to-date avoidance. Are you sure you’ve added proper dependencies as well? I’d suggest that you configure Kotest in the
services/shared/build.gradle
directly until you can run the tests, and only then start extracting the build logic
👍🏻 1
p
configure Kotest directly? is there something more than what i currently have:
Copy code
dependencies {
    api(project(":p8e:proto"))

    implementation.let {
        it(Libraries.ProvenanceCoreProto)
    }

    testImplementation.let {
        it(Libraries.KotlinXCoRoutinesTest)
        it(Libraries.Kotest)
        it(Libraries.KotestAssertions)
        it(Libraries.KotlinLogging)
    }

    tasks.withType<Test> {
        useJUnitPlatform()
    }
}
w
🤔 I also have
junit5
dependency applied
p
hmm.. is that not transitively included from
Copy code
const val Kotest = "io.kotest:kotest-runner-junit5-jvm:${Versions.Kotest}"
i dont have it declared in any of the other sub projects and no problems there
👍 1
w
Anyway, by
configure Kotest directly
I meant to have entire project configuration in the subproject’s
build.gradle
directly. In one of the previous snippets you mentioned having
subprojects { }
in root build.gradle file, that’s why I suggested to not use root build.gradle but just make sure you have all the proper configuration in the subproject build.gradle
👍 1
p
let me throw it in for posterity
w
But anyway if the tests work in some other subproject but not in that specific one then it’s difficult to say. You can try comparing the dependencies (
./gradlew :workingProject:dependencies
vs
./gradlew :notWorking:dependencies
) for example
Check that the paths are the same, maybe
kotlin
source sets aren’t set properly? (I used to put everything under
src/java/
to be sure)
p
ok thanks - let me double check those a bit