https://kotlinlang.org logo
#gradle
Title
# gradle
d

dave08

03/02/2023, 2:42 PM
I wonder if now there's better support for viewing test results from a gradle multi-module project in Intellij?
I keep on having to run those tests module-by-module...
I tried putting this in the root project:
Copy code
tasks.named<Test>("test") {
    useJUnitPlatform { }
    testLogging {
        showExceptions = true
        showStandardStreams = true
        exceptionFormat = FULL
    }
}
but it seems like it only runs one of my module's tests...
(I put the same thing in my
subprojects { }
block in the root too.)
c

CLOVIS

03/02/2023, 2:54 PM
If you run a test task in IntelliJ, it will show the test results for all modules in the same window
d

dave08

03/02/2023, 2:54 PM
It doesn't for me... 😢
I'm wondering if I'm missing some configuration or something...
c

CLOVIS

03/02/2023, 2:56 PM
If you want to compare, it works for me on this project, there is run configuration called "Test" that runs all JS and JVM tests for all modules: https://gitlab.com/opensavvy/pedestal
You can clone it, check if it works for you with that project—if it does, you can figure out what you did differently, and if it doesn't I can help you find what's different with my setup
d

dave08

03/02/2023, 3:00 PM
Thanks, I'll take a look!
Where is that Test configuration?
It's not in the root gradle file
c

CLOVIS

03/02/2023, 4:39 PM
Sorry for the delay. It's directly in the IntelliJ run configurations (top-right, the dropdown beside the run button). It should be called "test" or "all tests" or "check", I don't remember
Ah, it's called "All tests"
d

dave08

03/02/2023, 4:40 PM
You defined that somewhere in Gradle?
c

CLOVIS

03/02/2023, 4:41 PM
d

dave08

03/02/2023, 4:42 PM
Funny, I found it in the run gradle tasks dialog...
c

CLOVIS

03/02/2023, 4:42 PM
When you run it, you should see all test results for all projects in the IDEA window
d

dave08

03/02/2023, 4:43 PM
Even in this dialog, there's something called allTests that I don't know where it's coming from...
c

CLOVIS

03/02/2023, 4:44 PM
It's from Gradle. It's created by the
kotlin("multiplatform")
plugin. If you use
kotlin("jvm")
or another variant it's probably just called
test
. You can run
./gradlew tasks
at the root of the project to find its name
d

dave08

03/02/2023, 4:45 PM
That's exactly my problem, when I run that
test
gradle task on my root project, it only runs part of the tests, not all of them...
The funniest thing is that on the command line ./gradlew test runs them all...
c

CLOVIS

03/02/2023, 4:51 PM
Did you edit the
test
task in any way?
d

dave08

03/02/2023, 4:52 PM
In the ide, no... I just used the gradle window to run test from...
It created the idea run task for me
Ok thanks! I tried creating that IDEA run cofiguration manually, and it works!
Boy, I had almost given up on multi-modules because of this!
9 Views